*** PARENTS ***


********************************************************************************
********************************************************************************

							* PARENTS SURVEY *

********************************************************************************
********************************************************************************


use "$Endline_dtRaw/parents/Version 6/Questionrio 1 - Pais e Encarregados de Educao.dta", clear

append using "$Endline_dtRaw/parents/Version 7/parents.dta"

label drop _all
********************************************************************************

// Identification cleaning, apply to all rosters!

drop if inlist(interview__key,"64-28-57-75","92-80-89-09","35-78-86-48","78-47-99-28","32-88-27-22","19-30-08-74","73-75-71-61","56-26-81-71","09-83-44-78")
drop if inlist(interview__key,"65-16-41-36","43-49-48-80","40-10-54-24","44-53-39-68","78-78-89-65","60-25-22-66","53-15-69-36","90-33-37-37","87-73-93-23")
drop if inlist(interview__key,"80-84-89-39","28-07-29-80","15-73-45-11","24-91-83-04","02-63-39-39","44-60-63-41","24-35-80-93","24-53-68-55","80-09-35-07")
drop if inlist(interview__key,"81-88-65-04","09-92-96-89","59-45-79-54","22-33-89-91","45-39-75-00","33-30-68-34","89-66-12-98","03-37-77-37","35-47-45-19")
drop if inlist(interview__key,"67-10-11-98","44-55-09-95","84-57-80-09","15-52-63-87","74-58-79-44")

********************************************************************************

// Errors identified by hand

replace resp_id = 34 if interview__key == "23-41-84-24"
replace resp_id = 23 if interview__key == "75-15-51-24"
replace resp_id = 8 if interview__key == "67-28-82-17"
replace resp_id = 20 if interview__key == "27-28-93-22"
replace resp_id = 5 if interview__key == "56-12-75-46"
replace resp_id = 6 if interview__key == "31-82-32-51"
replace resp_id = 15 if interview__key == "93-96-46-05"
replace resp_id = 16 if interview__key == "11-51-55-73"
replace resp_id = 26 if interview__key == "70-20-77-96"
replace resp_id = 4 if interview__key == "95-88-17-39"
replace resp_id = 11 if interview__key == "95-86-36-39"
replace resp_id = 41 if interview__key == "90-72-27-77"
replace resp_id = 34 if interview__key == "41-48-83-41"
replace resp_id = 36 if interview__key == "13-01-46-68"
replace resp_id = 31 if interview__key == "75-92-14-73"
replace resp_id = 22 if interview__key == "95-41-93-26"
replace resp_id = 41 if interview__key == "25-40-24-67"
replace resp_id = 23 if interview__key == "91-45-23-94"
replace resp_id = 23 if interview__key == "82-79-42-16"
replace resp_id = 28 if interview__key == "14-97-55-90"
replace resp_id = 14 if interview__key == "87-08-18-35"
replace resp_id = 11 if interview__key == "28-40-22-76"
replace resp_id = 11 if interview__key == "75-23-49-91"
replace resp_id = 2 if interview__key == "38-07-92-64"
replace resp_id = 19 if interview__key == "11-36-52-10"
replace resp_id = 5 if interview__key == "53-79-17-25"
replace resp_id = 4 if interview__key == "40-53-06-68"
replace resp_id = 32 if interview__key == "42-50-55-35"
replace resp_id = 1 if interview__key == "02-60-11-60"
replace resp_id = 41 if interview__key == "33-84-03-21"
replace resp_id = 6 if interview__key == "75-04-68-50"
replace resp_id = 15 if interview__key == "03-08-06-02"
replace resp_id = 37 if interview__key == "28-08-17-94"
replace resp_id = 24 if interview__key == "39-01-49-87"
replace resp_id = 19 if interview__key == "82-83-41-45"
replace resp_id = 25 if interview__key == "10-04-29-04"
replace resp_id = 33 if interview__key == "08-19-80-14"
replace resp_id = 11 if interview__key == "72-04-70-63"

replace school_id = 4 if interview__key == "72-04-70-63"
replace school_id = 12 if interview__key == "28-08-17-94"
replace school_id = 15 if interview__key == "39-01-49-87"
replace school_id = 20 if interview__key == "94-94-56-01"
replace school_id = 25 if interview__key == "17-01-54-55"
replace school_id = 38 if interview__key == "73-48-68-52"
replace school_id = 53 if interview__key == "64-58-20-62"
replace school_id = 60 if interview__key == "36-86-18-15"
replace school_id = 60 if interview__key == "72-97-97-12"
replace school_id = 67 if interview__key == "94-79-71-79"
replace school_id = 75 if interview__key == "69-96-43-95"
replace school_id = 78 if interview__key == "62-32-25-41"
replace school_id = 78 if interview__key == "43-95-43-69"
replace school_id = 88 if interview__key == "08-46-69-90"
replace school_id = 94 if interview__key == "55-71-00-24"
replace school_id = 17 if interview__key == "36-25-96-53"
replace school_id = 5 if interview__key == "20-78-65-51"
replace school_id = 104 if interview__key == "49-76-79-84"
replace school_id = 116 if interview__key == "74-58-79-44"

replace student_name = "Carolina Antonio Joaquim" if interview__key == "29-30-33-39"
replace student_name = "Higino Moisés Lemberino Mateus" if interview__key == "94-91-14-38"
replace student_name = "Neves Domingos" if interview__key == "14-52-56-59"
replace student_name = "Eduardo Brechior" if interview__key == "20-14-37-97"
replace student_name = "Maria de Fatima Mario" if interview__key == "48-53-59-54"

replace resp_name = "Luis M. Morais" if interview__key == "09-85-56-76"
replace resp_name = "Augusto Fausto" if interview__key == "84-74-85-12"

replace interviewer = 4 if interview__key == "75-04-68-50"
replace interviewer = 22 if interview__key == "03-08-06-02"
replace interviewer = 22 if interview__key == "43-19-76-51"

replace supervisor = 5 if interview__key == "68-24-70-55"
replace supervisor = 5 if interview__key == "41-46-44-00"

replace student_grade = 3 if interview__key =="20-65-61-88"
replace student_grade = 4 if interview__key =="43-27-40-77"

********************************************************************************

// Identification variables for matching

gen survey_type = 1

gen parent_id2 = 100*school_id + resp_id

********************************************************************************

// Survey solutions variables

order interview__key interview__id sssys_irnd has__errors

drop interview__status

label variable interview__id "Unique 32-character long identifier"
label variable interview__key "Interview key (XX-XX-XX-XX format)"
label variable sssys_irnd "Random number range 0..1 associated with interview"
label variable has__errors "Errors count in the interview"

rename interview__id 	ss_id
rename interview__key 	ss_key
rename sssys_irnd 		ss_random
rename has__errors 		ss_errors

********************************************************************************

// add municipality and treatment variable to data set

gen municipality = .

replace municipality = 1 if inlist(school_id,1,2,3,4,5,6,7,8,9,10,12,13,	///
	14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,32,33,34,35,37,		///
	40,45,61,86,110)

replace municipality = 2 if inlist(school_id,23,43,44,46,47,48,49,50,51,	///
	52,53,54,55,56,57,58,59,60,62,63,64,65,66,67,68,69,70,71,72,73,75,76,	///
	77,78,79,80,81)

replace municipality = 3 if inlist(school_id,11,36,38,39,41,42,74,82,83,84,	///
	85,87,88,89,90,91,92,93,94,95,96,97,98,99,101,102,103,104,105)

replace municipality = 4 if inlist(school_id,118,119,120,121,122,123,124,125)
replace municipality = 5 if inlist(school_id,100,112,113,114,115,116,117)
replace municipality = 6 if inlist(school_id,109,111)
replace municipality = 7 if inlist(school_id,106,107)
replace municipality = 8 if inlist(school_id,126)
replace municipality = 9 if inlist(school_id,108)

gen treatment = .

replace treatment = 0 if inlist(school_id,3,4,7,10,16,18,20,23,26,29,33, ///
	39,42,53,55,62,63,64,65,78,81,84,87,88,89,92,98,108,109,116,117,121)

replace treatment = 1 if inlist(school_id,15,19,22,27,32,36,37,40,49,51, ///
	56,57,58,61,66,68,72,76,79,82,83,86,91,95,100,102,103,106,110,114,125,126)

replace treatment = 2 if inlist(school_id,1,5,6,11,12,14,21,24,25,31,41, ///
	48,50,52,59,70,73,77,80,90,93,94,101,105,107,111,112,113,119,120,124)

replace treatment = 3 if inlist(school_id,2,8,9,13,17,28,30,34,35,38,43, ///
	44,45,46,47,54,60,67,69,71,74,75,85,96,97,99,104,115,118,122,123)

********************************************************************************

// add indicator for number of selected students

gen selection = .

replace selection = 30 if inlist(school_id,1,2,3,4,5,7,9,15,16,17,18,22,24, ///
	25,30,31,34,37,40,46,48,49,52,53,54,55,60,64,69,71,74,75,79,86,87,88,	///
	89,97,112,116,118,119,120,121)

replace selection = 40 if inlist(school_id,6,8,10,11,12,13,14,19,20,21,26,	///
	28,29,32,33,35,36,38,39,41,42,43,44,45,47,50,51,56,57,58,59,61,62,63,	///
	65,66,67,68,70,72,73,76,77,78,80,81,82,83,84,85,90,91,92,93,94,95,96,	///
	98,99,100,101,102,103,104,105,106,107,108,109,110,111,113,114,115,117,	///
	122,123,124,125,126)

replace selection = 33 if school_id==23

replace selection = 37 if school_id==27

********************************************************************************

order 	parent_id2 survey_type selection school_id resp_id municipality 	///
		treatment supervisor interviewer date_time_start date_time_end		///
		, after(ss_errors)

********************************************************************************

// labelssss

#delimit ;
;
label define treatment
0	"Control group"
1	"Door-to-door"
2	"Meetings"
3	"Both treatments"
;
label define municipality
1	"Sumbe"
2	"Porto Amboim"
3	"Gabela"
4	"Conda"
5	"Ebo"
6	"Quilenda"
7	"Seles"
8	"Cassongue"
9	"Quibala"
;
label define enum
1	"Antonio Lopes Miguel Rocha"
2	"Augusta Júlio Miranda"
3	"César Zau Joaquim Morais Mendes"
4	"Edesdeth Abrantes Fonseca"
5	"Fernando Portugal Leonardo"
6	"Filipe Quissana Cariengue"
7	"Herlander Mauro Lemos Lima"
8	"Manuel Aguinaldo Barroso Moreira Francisco"
9	"Albertina de Oliveira Armando"
10	"Augusto Viana Kupinga"
11	"Beatriz Laurinda Teixeira da Costa"
12	"Carlos da Fonseca Ricardo "
13	"Carolina Germano da Silva"
14	"Felizarda Luis Avelino"
15	"Hermínia Caetano Kalolo"
16	"Ilídio Duarte Reis Cardoso"
17	"Isabel Marcolino Lisboa"
18	"João Monteiro Bimbe"
19	"José Alberto Nungulo Kamucunja"
20	"Manuel Pinheiro Inacio Ernesto"
21	"Marimilia Francisco Fernando"
22	"José Bambi Kandjeke"
23	"Samora Paulo José Ganga"
24	"Victória Maneco Tavares"
25	"Adelaide Fernando Miguens"
26	"Adelaide Marcelina da Cruz Zeferino"
27	"Adilson Fragoso Pascoal Inácio Filipe"
28	"Amaro Alberto Chipa"
29	"Ana Paula Silvestre Ventura"
30	"Antonio Calei Pedro da Silva"
31	"António Manuel da Silva"
32	"Bernardo Miguêns Gimbo"
33	"Bernardo Sungo Manuel Zau"
34	"Bráulio Eanes Gabriel Alberto"
35	"Bruno José Fernando Viegas"
36	"Carvalinho António Correia"
37	"Cirineu Jr. Jorge"
38	"Domingos Guimarães Sumano"
39	"Elvino António Sobral Salomão"
40	"Etelvina Albertina Francisco Teixeira"
41	"Helder Silvestre Lino Tomé Pinto"
42	"Joana Pinto Soma"
43	"Jonas Frederico Albino Rangel"
44	"José Catraio António"
45	"José Luciano Januário"
46	"José Maria Sumano Delgado"
47	"José Pinto Fançony"
48	"Magalhães Salissinga Gomes"
49	"Maria de Fátima Paulo Feliciano"
50	"Mariza Fernando Manuel Vales"
51	"Monteiro Bastos"
52	"Nilton Januário Valentim"
53	"Sara Claúdio Vidro Aguiar Maneco"
54	"Telma da Conceição Mweleyavo António"
55	"Teresa Aguiar da Costa"
56	"Teresa Kizua Kassucada"
57	"Bruno Avelino Segunda"
58	"Inocêncio Mário Cupenala"
59	"Sabino Jorge Bira"
;
label define dummy
0	"No"
1 	"Yes"
;
label define survey_type
1	"Parent"
2	"Teacher"
3	"Director"
;
label define student_grade
3 `"3rd grade"'
4 `"4th grade"'
5 `"5th grade"'
;
label define resp_relation
1 `"Parent"'
2 `"Uncle/aunt"'
3 `"Brother/sister"'
4 `"Grandparent"'
5 `"Cousin"'
6 `"Step parent"'
7 `"Brother/sister in law"'
8 `"Close friend family"'
;
label define location
1 `"School"'
2 `"Home respondent"'
3 `"FAS office"'
4 `"Workplace"'
5 `"Other school"'
;
label define female
0 `"Male"'
1 `"Female"'
;
label define edu
0 `"No education"'
1 `"First grade"'
2 `"Primary school 1 (grades 1-4)"'
3 `"Primary school 2 (grades 5-6)"'
4 `"Secondary school 1 (grades 7-8) terceiro nivel"'
5 `"Secondary school 2 (grades 9-12) - ensino medio"'
6 `"Technical and Vocational Education (2-4 years)"'
7 `"Goes to university"'
8 `"Bacharel - Angola"'
9 `"Bachelor - Angola"'
10 `"Master - Angola"'
11 `"University - abroad"'
;
label define ocu
1 `"Part-time job in private sector"'
2 `"Part-time job in public sector"'
3 `"Full-time job in private sector"'
4 `"Full-time job in public sector"'
5 `"Self-employed"'
6 `"Business owner, employs other people"'
7 `"Farmer works with the family"'
8 `"Farmer, employs other people"'
9 `"Fisherman"'
10 `"Religious work"'
11 `"Retired"'
12 `"Student"'
13 `"Housewife"'
14 `"Unemployed"'
15 "Local leader or elected official"
16 "Shepherd"
17 "Voluntary teacher"
;
label define residence_loc
1 `"School neighborhood"'
2 `"Other neighborbood in school municipality"'
3 `"Outside of the school municipality"'
;
label define marital
1 `"Maried"'
2 `"Live together"'
3 `"Single"'
4 `"Widow"'
5 `"Divorced"'
;
label define residence_own
1 `"Property"'
2 `"Rented"'
3 `"Made available by family"'
4 `"Made available by community"'
5 `"Made available by state"'
6 `"Lives with parents"'
;
label define income
1 `"Less than 5 000 AKZ/month"'
2 `"5 001 - 10 000 AKZ/month"'
3 `"10 001 - 25 000 AKZ/month"'
4 `"25 001 - 50 000 AKZ/month"'
5 `"50 001 - 100 000 AKZ/month"'
6 `"100 001 - 150 000 AKZ/month"'
7 `"150 001 - 200 000 AKZ/month"'
8 `"More than 200 001 AKZ/month"'
;
label define language
1 `"Portugues"'
2 `"Umbundu"'
3 `"Kimbundu"'
4 `"Kicongo"'
5 `"Ngoia"'
6 "Ngangula"
7 "Hele"
;
label define transportation
1 `"By foot"'
2 `"Hitchhike"'
3 `"Bicycle"'
4 `"Minivan taxi"'
5 `"Bike taxi"'
6 `"Own bike"'
7 `"Own car"'
8 `"Rented bike"'
;
label define distance_home
1 `"Less than 500 meters"'
2 `"501 meters - 1 km"'
3 `"1 - 5 km"'
4 `"6 - 10 km"'
5 `"10 - 20 km"'
6 `"More than 20 km"'
;
#delimit cr

********************************************************************************

drop consensus

label values supervisor interviewer enum
label values municipality municipality
label values treatment treatment
label values survey_type survey_type
label values student_grade student_grade
label values resp_relation resp_relation
label values location location
label values arrivedalone dummy

label variable date_time_start 	`"Date and time start interview"'
label variable date_time_end 	`"Date and time end interview"'
label variable school_id 		`"ID number school"'
label variable municipality 	"Municipality"
label variable treatment 		"Treatment group"
label variable supervisor 		`"Supervisor"'
label variable interviewer 		`"Interviewer"'
label variable resp_id 			`"ID number respondent"'
label variable resp_name		`"Name respondent"'
label variable resp_tel 		`"Phone number respondent"'
label variable selection 		"Number of randomly selected students"
label variable parent_id2 		"Identification for merge with games"
label variable survey_type 		`"Survey type"'
label variable student_name 	`"Name student"'
label variable nome 			`"Short name student"'
label variable student_grade 	`"Grade selected student"'
label variable resp_relation 	`"Parent-student relation"'
label variable location 		`"Location where interview took place"'
label variable arrivedalone 	`"Respondent arrived alone at the school"'

replace resp_relation = . if resp_relation==6
replace resp_relation = 1 if resp_relation_other=="Tutora"
replace resp_relation = 2 if resp_relation_other=="Irmã da mãe"
replace resp_relation = 2 if resp_relation_other=="Irmão do Pai"
replace resp_relation = 2 if resp_relation_other=="Sobrinha"
replace resp_relation = 2 if resp_relation_other=="sobrinho"
replace resp_relation = 6 if resp_relation_other=="Madrasta"
replace resp_relation = 6 if resp_relation_other=="Padastro"
replace resp_relation = 6 if resp_relation_other=="Padrasto"
replace resp_relation = 6 if resp_relation_other=="Padrinho"
replace resp_relation = 7 if resp_relation_other=="Concunhada (esposa do irmão mas velho)"
replace resp_relation = 7 if resp_relation_other=="cunhada"
replace resp_relation = 7 if resp_relation_other=="Cunhada"
replace resp_relation = 7 if resp_relation_other=="Cunhada/Encarregado"
replace resp_relation = 8 if resp_relation_other=="Chara"
replace resp_relation = 8 if resp_relation_other=="Vizinho Chegado da família"

replace location = . if location==3
replace location = 3 if location_other=="Escritorio"
replace location = 3 if location_other=="Escritório"
replace location = 3 if location_other=="Escritório"
replace location = 3 if location_other=="Escritório"
replace location = 3 if location_other=="Escritório"
replace location = 3 if location_other=="Escritório Da Direcção do FAS"
replace location = 3 if location_other=="Escritorio do fas"
replace location = 3 if location_other=="Escritorio do Fas"
replace location = 3 if location_other=="Escritorio do FAS"
replace location = 3 if location_other=="Escritório do FAS"
replace location = 3 if location_other=="Escritório do FAS"
replace location = 3 if location_other=="Fas"
replace location = 3 if location_other=="FAS"
replace location = 3 if location_other=="No escritório do FAS"
replace location = 4 if location_other=="mercado"
replace location = 4 if location_other=="Mercado Local"
replace location = 4 if location_other=="Mercado Local"
replace location = 4 if location_other=="Praça"
replace location = 4 if location_other=="Local de trabalho"
replace location = 4 if location_other=="local de trabalho"
replace location = 4 if location_other=="Lavra"
replace location = 4 if location_other=="centro médico"
replace location = 4 if location_other=="NA PARIA"
replace location = 4 if location_other=="NA PRAIA"
replace location = 5 if location_other=="outra escola"
replace location = 5 if location_other=="Outra Escola 336"

drop resp_relation_other location_other

foreach var in date_time_start date_time_end{
replace `var' = "" if `var'=="##N/A##"
}

replace interviewer = . if interviewer==-999999999
replace resp_tel = . if inlist(resp_tel,-999999999,999)

********************************************************************************


********************************************************************************

* Section 1

drop aor aorcap senhor aas ees aam estaestao vaivao ao aocap mais outros

label variable P01_01 `"Age respondent"'
label variable P01_02 `"Gender respondent"'
label variable P01_03 `"Current home neighbourhood relative to the school"'
label variable P01_03_other2 `"Other current home neighbourhood if in same municipality as school"'
label variable P01_03_other3 `"Current home municipality if not in same municipality as school"'
label variable P01_04 `"Birthplace relative to the school"'
label variable P01_04_other2 `"Other birthplace (neighbourhood) if in same municipality as school"'
label variable P01_04_other3 `"Birthplace (municipality) if not in same municipality as school"'
label variable P01_05 `"Years of living in current neighbourhood"'
label variable P01_06 `"Highest level of education enjoyed by respondent"'
label variable P01_07 `"Occupation respondent"'
label variable P01_08 `"Marital status respondent"'
label variable P01_09 `"Highest level of education enjoyed by partner respondent"'
label variable P01_10 `"Occupation partner respondent"'
label variable P01_11 `"Type of home in terms of ownership"'
label variable P01_12 `"Monthly total home income"'
label variable P01_13 `"How many of your children live with you?"'
label variable P01_14 `"How many children live with you but are not your children?"'
label variable P01_15 `"How many of the children that live with you are girls?"'
label variable P01_16 `"How many of the children living in your home attend this elementary school"'
label variable P01_17__0 `"Has children in pre-school"'
label variable P01_17__1 `"Has children in grade 1"'
label variable P01_17__2 `"Has children in grade 2"'
label variable P01_17__3 `"Has children in grade 3"'
label variable P01_17__4 `"Has children in grade 4"'
label variable P01_17__5 `"Has children in grade 5"'
label variable P01_17__6 `"Has children in grade 6"'
label variable P01_17__7 `"Has children in grade 7"'
label variable P01_17__8 `"Has children in grade 8"'
label variable P01_17__9 `"Has children in grade 9"'
label variable P01_18 `"Language spoken at home"'
label variable P01_19 `"Method of transportation used by children between home and school"'
label variable P01_20 `"Time in minutes spend by children between home and school"'
label variable P01_21 `"Aproximate distance in km between home and school"'

label values P01_02 female
label values P01_03 residence_loc
label values P01_04 residence_loc
label values P01_06 edu
label values P01_07 ocu
label values P01_08 marital
label values P01_09 edu
label values P01_10 ocu
label values P01_11 residence_own
label values P01_12 income
label values P01_18 language
label values P01_19 transportation
label values P01_21 distance_home
lab val P01_17__0 P01_17__1 P01_17__2 P01_17__3 P01_17__4 P01_17__5 		///
		P01_17__6 P01_17__7 P01_17__8 P01_17__9 dummy

foreach var in P01_01 P01_04 P01_05 P01_06 P01_07 P01_09 P01_10 P01_12 		///
		P01_14 P01_18 P01_19 P01_20 P01_21{
replace `var' = . if inlist(`var',-999999999,999)
}

replace P01_08 = . if P01_08==6

foreach var in P01_03_other2 P01_03_other3 P01_04_other2 P01_04_other3{
replace `var' = "" if `var'=="##N/A##"
}

replace P01_07 = . if P01_07==15

replace P01_07 = 3 if P01_07_other=="Segurança"
replace P01_07 = 5 if P01_07_other=="biscatos"
replace P01_07 = 5 if P01_07_other=="Carpinteiro"
replace P01_07 = 5 if P01_07_other=="Carpinteiro"
replace P01_07 = 5 if P01_07_other=="Carpinteiro"
replace P01_07 = 5 if P01_07_other=="Carpinteiro"
replace P01_07 = 5 if P01_07_other=="carpinteiro"
replace P01_07 = 5 if P01_07_other=="Carpinteiro"
replace P01_07 = 5 if P01_07_other=="Cerralheiro"
replace P01_07 = 5 if P01_07_other=="comerciante"
replace P01_07 = 5 if P01_07_other=="comerciante"
replace P01_07 = 5 if P01_07_other=="comerciante"
replace P01_07 = 5 if P01_07_other=="Comerciante"
replace P01_07 = 5 if P01_07_other=="Comerciante"
replace P01_07 = 5 if P01_07_other=="Conta propria"
replace P01_07 = 5 if P01_07_other=="conta própria"
replace P01_07 = 5 if P01_07_other=="CONTA PRÓPRIA"
replace P01_07 = 5 if P01_07_other=="Dona de um negócio mas não emprega outras pessoas"
replace P01_07 = 5 if P01_07_other=="Dona de um negócio não emprega"
replace P01_07 = 5 if P01_07_other=="Dona de um negócio não emprega"
replace P01_07 = 5 if P01_07_other=="Fazer Luandos ou esteiras"
replace P01_07 = 5 if P01_07_other=="Fotógrafo"
replace P01_07 = 5 if P01_07_other=="kupapata"
replace P01_07 = 5 if P01_07_other=="Mecânico"
replace P01_07 = 5 if P01_07_other=="Motorista"
replace P01_07 = 5 if P01_07_other=="Motorista"
replace P01_07 = 5 if P01_07_other=="Motorista"
replace P01_07 = 5 if P01_07_other=="Motorista"
replace P01_07 = 5 if P01_07_other=="mototaxista"
replace P01_07 = 5 if P01_07_other=="Parteira Tradicional"
replace P01_07 = 5 if P01_07_other=="pedreira"
replace P01_07 = 5 if P01_07_other=="pedreiro"
replace P01_07 = 5 if P01_07_other=="Pedreiro"
replace P01_07 = 5 if P01_07_other=="Pedreiro"
replace P01_07 = 5 if P01_07_other=="pedreiro"
replace P01_07 = 5 if P01_07_other=="Pedreiro"
replace P01_07 = 5 if P01_07_other=="Pedreiro"
replace P01_07 = 5 if P01_07_other=="Praticante de Carpintaria"
replace P01_07 = 5 if P01_07_other=="Radialista"
replace P01_07 = 5 if P01_07_other=="Serralheiro"
replace P01_07 = 5 if P01_07_other=="serralheiro"
replace P01_07 = 5 if P01_07_other=="Taxista"
replace P01_07 = 5 if P01_07_other=="Tratorista"
replace P01_07 = 5 if P01_07_other=="tratorista"
replace P01_07 = 5 if P01_07_other=="Vendedeira"
replace P01_07 = 5 if P01_07_other=="vendedor de chinelos"
replace P01_07 = 5 if P01_07_other=="Vendedora ambulante"
replace P01_07 = 5 if P01_07_other=="vendedora ambulante"
replace P01_07 = 6 if P01_07_other=="Negociante"
replace P01_07 = 6 if P01_07_other=="Salão de Beleza"
replace P01_07 = 7 if P01_07_other=="camponês"
replace P01_07 = 7 if P01_07_other=="camponês"
replace P01_07 = 7 if P01_07_other=="Criador de Gado"
replace P01_07 = 9 if P01_07_other=="pescador"
replace P01_07 = 10 if P01_07_other=="Pastor de uma Igreja"
replace P01_07 = 11 if P01_07_other=="reformado"
replace P01_07 = 11 if P01_07_other=="Reformado"
replace P01_07 = 12 if P01_07_other=="Estudante"
replace P01_07 = 12 if P01_07_other=="Estudante"
replace P01_07 = 12 if P01_07_other=="Estudante"
replace P01_07 = 12 if P01_07_other=="estudante e da explicacao em casa."
replace P01_07 = 13 if P01_07_other=="Domestica"
replace P01_07 = 14 if P01_07_other=="Jogador de Futebol não remunerado"
replace P01_07 = 15 if P01_07_other=="Soba"
replace P01_07 = 15 if P01_07_other=="soba do bairro"
replace P01_07 = 17 if P01_07_other=="Professor colaborador na escola pública"
replace P01_07 = 17 if P01_07_other=="Professor voluntário"
replace P01_07 = 17 if P01_07_other=="Professora colaboradora"
replace P01_07 = 17 if P01_07_other=="professora Colaboradora"

replace P01_10 = . if P01_10==15

replace P01_10 = 4 if P01_10_other=="enfermeiro"
replace P01_10 = 4 if P01_10_other=="Militar"
replace P01_10 = 4 if P01_10_other=="Professor/colaborador"
replace P01_10 = 4 if P01_10_other=="Serviço Militar"
replace P01_10 = 5 if P01_10_other=="Comerciante"
replace P01_10 = 5 if P01_10_other=="custureira"
replace P01_10 = 5 if P01_10_other=="Dona de um negócio (não emprega outras pessoas)"
replace P01_10 = 5 if P01_10_other=="Dono de um negócio não emprega"
replace P01_10 = 5 if P01_10_other=="Empregada de uma casa"
replace P01_10 = 5 if P01_10_other=="Marceneiro"
replace P01_10 = 5 if P01_10_other=="Motorista"
replace P01_10 = 5 if P01_10_other=="Motorista"
replace P01_10 = 5 if P01_10_other=="motorista"
replace P01_10 = 5 if P01_10_other=="motorista"
replace P01_10 = 5 if P01_10_other=="Moturista"
replace P01_10 = 5 if P01_10_other=="Padeiro"
replace P01_10 = 5 if P01_10_other=="vendedora"
replace P01_10 = 5 if P01_10_other=="vendedora"
replace P01_10 = 5 if P01_10_other=="vendedora Ambulante"
replace P01_10 = 5 if P01_10_other=="vendedora de peixe"
replace P01_10 = 5 if P01_10_other=="vendedora no mercado"
replace P01_10 = 5 if P01_10_other=="Zunga"
replace P01_10 = 11 if P01_10_other=="reformada"
replace P01_10 = 13 if P01_10_other=="Director"
replace P01_10 = 13 if P01_10_other=="Doméstica"
replace P01_10 = 13 if P01_10_other=="Doméstica"
replace P01_10 = 13 if P01_10_other=="Doméstica"
replace P01_10 = 13 if P01_10_other=="Doméstica"
replace P01_10 = 13 if P01_10_other=="Doméstica"
replace P01_10 = 15 if P01_10_other=="Soba Adjuntos E Activistas"

replace P01_13 = 4 if P01_13==40

replace P01_18 = . if P01_18 == 6

replace P01_18 = 1 if P01_18_other=="Portugues e umbundu"
replace P01_18 = 1 if P01_18_other=="Umbundu e o Portugues"
replace P01_18 = 5 if P01_18_other=="Ngoia"
replace P01_18 = 5 if P01_18_other=="Ngoia"
replace P01_18 = 6 if P01_18_other=="Ngagula"
replace P01_18 = 6 if P01_18_other=="Ngangula"
replace P01_18 = 7 if P01_18_other=="hele"

drop P01_07_other P01_10_other P01_11_other P01_18_other P01_19_other

********************************************************************************

********************************************************************************

* Section 2

// labelssss

#delimit ;
;
label define P02_14
1 `"Work at the farm or river"'
2 `"Work at the family business or home"'
3 `"Did not want to go to school"'
4 `"Was sick"'
5 `"A family member was sick"'
6 `"Funeral"'
7 `"Rain"'
8 `"No teacher"'
9 `"Holiday"'
10 "No clean clothes, material, food or money"
11 "No transport"
12 "Was late but registered as missing"
;
lab def guess
0 "Guess"
1 "Do not know"
;
#delimit cr

foreach var in P02_01 P02_04 P02_05 P02_13 P02_14{
		replace `var' = . if inlist(`var',999,-999999999)
}

label variable P02_01 `"Age student"'
label values P02_02 female
label variable P02_02 `"Gender student"'

label variable P02_03 `"Number of brother/sisters"'

label values P02_04 dummy
label variable P02_04 `"Brother/sisters at this school"'

label values P02_05 dummy
label variable P02_05 `"Brother/sisters at other elementary school"'

label variable P02_06 `"Name of director"'

gen P02_06_DK = 0
replace P02_06_DK = 1 if inlist(P02_06,"999","0")
lab var P02_06_DK "Parent does not know the name of the director"
lab val P02_06_DK guess
order P02_06_DK, after(P02_06)
label values P02_07 dummy
label variable P02_07 `"Director is friend or family"'
replace P02_06 = "" if inlist(P02_06,"999","0")


label variable P02_08 `"Name of professor"'
gen P02_08_DK = 0
replace P02_08_DK = 1 if inlist(P02_08,"999","0")
lab var P02_08_DK "Parent does not know the name of the teacher"
lab val P02_08_DK guess
order P02_08_DK, after(P02_08)
label values P02_09 dummy
label variable P02_09 `"Professor is friend or family"'
replace P02_08 = "" if inlist(P02_08,"999","0")

label variable P02_10 `"Name of previous professor"'
gen P02_10_DK = 0
replace P02_10_DK = 1 if inlist(P02_10,"999",".999","0","99)")
lab var P02_10_DK "Parent does not know the name of the teacher"
lab val P02_10_DK guess
order P02_10_DK, after(P02_10)
label values P02_11 dummy
label variable P02_11 `"Previous professor is friend or family"'
replace P02_10 = "" if inlist(P02_10,"999",".999","0","99)")

label variable P02_12 `"Number of students in group of student"'
gen P02_12_DK = 0
replace P02_12_DK = 1 if inlist(P02_12,999)
lab var P02_12_DK "Parent does not know the number of students in class child"
lab val P02_12_DK guess
order P02_12_DK, after(P02_12)
replace P02_12 = . if inlist(P02_12,999)

replace P02_13 = 0 if P02_14_other=="não faltou"

label variable P02_13 `"Missing days during last two weeks"'

gen P02_13_dummy = 0 if P02_13!=.
replace P02_13_dummy = 1 if P02_13>0 & P02_13_dummy == 0
lab val P02_13_dummy dummy
order P02_13_dummy, after(P02_13)
lab var P02_13_dummy "Was missing at least one day during the last two weeks"

label values P02_14 P02_14
label variable P02_14 `"Reason for missing during the last two weeks"'

replace P02_14 = . if P02_14==10
replace P02_14 = 1 if P02_14_other=="Foi a lavra"
replace P02_14 = 1 if P02_14_other=="Foi ao rio"
replace P02_14 = 2 if P02_14_other=="Trabalhos de casa"
replace P02_14 = 2 if P02_14_other=="por cuidar do irmão mas novo"
replace P02_14 = 3 if P02_14_other=="Brincadeira"
replace P02_14 = 3 if P02_14_other=="Brincadeiras ao longo do caminho"
replace P02_14 = 3 if P02_14_other=="cortar o cabelo"
replace P02_14 = 3 if P02_14_other=="ferias"
replace P02_14 = 3 if P02_14_other=="férias"
replace P02_14 = 3 if P02_14_other=="Festa de alambamento do irmão"
replace P02_14 = 3 if P02_14_other=="Foi pra ser trançada o cabelo"
replace P02_14 = 3 if P02_14_other=="foi pra ser trançada o cabelo"
replace P02_14 = 3 if P02_14_other=="pensou que fosse Feriado"
replace P02_14 = 3 if P02_14_other=="por falta de imteresse"
replace P02_14 = 3 if P02_14_other=="Viagem Em família"
replace P02_14 = 3 if P02_14_other=="Viagem."
replace P02_14 = 3 if P02_14_other=="Brigou com um  colega na escola"
replace P02_14 = 4 if P02_14_other=="Esta doente"
replace P02_14 = 4 if P02_14_other=="esteve doente"
replace P02_14 = 4 if P02_14_other=="Ficou Ferido"
replace P02_14 = 4 if P02_14_other=="Tratar o Atestado Medico"
replace P02_14 = 8 if P02_14_other=="Aprofessora estava com doente no Hospital"
replace P02_14 = 8 if P02_14_other=="Ausência da Professora por motivo de doença"
replace P02_14 = 8 if P02_14_other=="Doença da professora"
replace P02_14 = 10 if P02_14_other=="A bata estava suja"
replace P02_14 = 10 if P02_14_other=="A bata estava suja"
replace P02_14 = 10 if P02_14_other=="A roupa estava suja"
replace P02_14 = 10 if P02_14_other=="A roupa estava suja"
replace P02_14 = 10 if P02_14_other=="Esteve a lavar roupa dela"
replace P02_14 = 10 if P02_14_other=="falta de calcados"
replace P02_14 = 10 if P02_14_other=="Falta de Chinelas"
replace P02_14 = 10 if P02_14_other=="Falta de roupa limpa"
replace P02_14 = 10 if P02_14_other=="Falta de roupa limpa"
replace P02_14 = 10 if P02_14_other=="Foi Lavar a roupa"
replace P02_14 = 10 if P02_14_other=="lavar roupa dela"
replace P02_14 = 10 if P02_14_other=="O uniforme não estava em condições"
replace P02_14 = 10 if P02_14_other=="por falta de bata limpa"
replace P02_14 = 10 if P02_14_other=="por falta de roupa limpa"
replace P02_14 = 10 if P02_14_other=="Por falta de uniforme"
replace P02_14 = 10 if P02_14_other=="Por falta falta de bata"
replace P02_14 = 10 if P02_14_other=="por uniforme não estar preparado"
replace P02_14 = 10 if P02_14_other=="Roupa estava suja"
replace P02_14 = 10 if P02_14_other=="Uniforme Sujo"
replace P02_14 = 10 if P02_14_other=="Falta de lápis"
replace P02_14 = 10 if P02_14_other=="Falta de materiais escolar"
replace P02_14 = 10 if P02_14_other=="Falta de material"
replace P02_14 = 10 if P02_14_other=="Falta de material"
replace P02_14 = 10 if P02_14_other=="falta de material escolar"
replace P02_14 = 10 if P02_14_other=="Farta de outros material didáticos"
replace P02_14 = 10 if P02_14_other=="por falta de caderno e lápis"
replace P02_14 = 10 if P02_14_other=="Por falta de matabicho"
replace P02_14 = 10 if P02_14_other=="Não pagou a própina"
replace P02_14 = 11 if P02_14_other=="A falta de valores de táxi"
replace P02_14 = 11 if P02_14_other=="Falta d meio"
replace P02_14 = 11 if P02_14_other=="Por causa da distância"
replace P02_14 = 12 if P02_14_other=="Faltou porque chegou atrasado"
replace P02_14 = 12 if P02_14_other=="Atraso"
replace P02_14 = 12 if P02_14_other=="Atraso"
replace P02_14 = 12 if P02_14_other=="Atraso"
replace P02_14 = 12 if P02_14_other=="atraso"
replace P02_14 = 12 if P02_14_other=="atraso por parte dela."
replace P02_14 = 12 if P02_14_other=="Atrasou"
replace P02_14 = 12 if P02_14_other=="Chegou Atrasado"
replace P02_14 = 12 if P02_14_other=="por atraso"
replace P02_14 = 12 if P02_14_other=="por ter atrasado"

drop P02_14_other

********************************************************************************

********************************************************************************

* Section 3

// labelssss

#delimit ;
;
label define freq1
0 `"Never"'
1 `"Once per week"'
2 `"Once per two weeks"'
3 `"Once per month"'
4 `"Once per two months"'
5 `"Once per trimester"'
6 `"Once per semester"'
7 `"Once per year"'
;
label define freq2
1 `"Very often"'
2 `"Often"'
3 `"Sometimes"'
4 `"Rare"'
5 `"Does not happen"'
;
label define appointment2
1 `"Via elections"'
2 `"Directly appointed"'

;
#delimit cr

foreach var in 	P03_02 P03_03 P03_04 P03_05 P03_06 P03_07 P03_08 P03_09 	///
				P03_10 P03_11 P03_13 P03_14 P03_12 P03_15 P03_16 P03_17 	///
				P03_18 P03_19 P03_20 P03_21 P03_22 P03_23 P03_24 P03_25 	///
				P03_26 P03_28 P03_29 P03_30 P03_31 P03_32 P03_33 P03_37	{
		replace `var' = . if inlist(`var',999,-999999999)
}

rename P03_01__11 P03_01__11_old
gen P03_01__11 = 0 if P03_01__1!=.
order P03_01__11, after(P03_01__10)

label variable P03_01__1 `"(Ordered) Parent role: Providing food for child"'
label variable P03_01__2 `"(Ordered) Parent role: Take care of child higiene"'
label variable P03_01__3 `"(Ordered) Parent role: Providing school material for child"'
label variable P03_01__4 `"(Ordered) Parent role: Providing school uniform for child"'
label variable P03_01__5 `"(Ordered) Parent role: Providing safe transport to school for child"'
label variable P03_01__6 `"(Ordered) Parent role: Help child with homework and talk to him/her"'
label variable P03_01__7 `"(Ordered) Parent role: Encourage and help with extracuricular activities"'
label variable P03_01__8 `"(Ordered) Parent role: Meet the teacher of the child"'
label variable P03_01__9 `"(Ordered) Parent role: Go to parent committee meetings"'
label variable P03_01__10 `"(Ordered) Parent role: Donate money, material and food to school/teachers"'
label variable P03_01__11 `"(Ordered) Parent role: Get a tutor"'

replace P03_01__2 = P03_01__11_old if P03_01__2==0 &  P03_01_other=="ajudar na higiene da escola."
replace P03_01__4 = P03_01__11_old if P03_01__4==0 &  P03_01_other=="Vestuário"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="ajudar nos trabalhos de casa"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Aprender ler e escrever..."
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Conversa com o aluno de modo a prestar atenção na aula"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Conversar com Ela"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Conversar com ela"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Dar atenção e certificar-se de que os filhos  estejam motivados."
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Dar sempre uma aulas em casa."
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="dialogar constantemente com a filha"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="ensinar a ler, acompanhar nas tarefas da escola"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Ensinar os filhos"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Explicar como devemos nos comportar"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="fazelhe intender que estudar è bom"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="orientar nas tarefas e trabalhos escolar"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Participação activa do processo do insino"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Aconselhar o aluno a respeitar o Professor"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Ensinar a respeitar todo mundo"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="incentivar a ir a escola"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Incentivar a levantar sedo para ir a escola"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Incentivar a participar nas aulas"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Incentivar a participar nas aulas com muita seriedade"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="incentivar o aluno"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="incentivar para ser alguém no futuro"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Incetivar a participar nas aulas"
replace P03_01__6 = P03_01__11_old if P03_01__6==0 &  P03_01_other=="Insentivar"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Aumentar mais salas de aula"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="contribuição para a segurança e energia"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Contribuição para contribuição de novas turmas"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="contribuir com algum valor..."
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Contribuir com dinheiro"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Contribuir com dinheiro para rebocar a escola"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Contribuir financeira. comprar material escolar para os alunos faserem prova."
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="contribuir para manter  o guarda"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="dar algumas contribuições"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Dinheiro"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Electricidade"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Garantir a segurança da escola"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="salas anexas"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Alimentação pra os professores estagiário e chapas para cubrir a escola...."
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Apoiar os professores com alimentação"
replace P03_01__10 = P03_01__11_old if P03_01__10==0 &  P03_01_other=="Contribuições para presentes dos professores"
replace P03_01__11 = P03_01__11_old if P03_01__11==0 &  P03_01_other=="Arranjar um explicador"
replace P03_01__11 = P03_01__11_old if P03_01__11==0 &  P03_01_other=="por a aluna na explicação"

drop P03_01__11_old P03_01__999 P03_01_other

label values P03_02 freq2
label variable P03_02 `"Frequency: clear rules at home"'

label values P03_03 freq2
label variable P03_03 `"Frequency: regular sleeping schedule"'

label values P03_04 freq2
label variable P03_04 `"Frequency: talk about school and children with other parents"'

label variable P03_05 `"Times helped with homework during last two weeks"'
label variable P03_06 `"Time spend on helping with homework (in minutes)"'
label variable P03_07 `"Times the family ate together during the last two weeks"'

label values P03_08 dummy
label variable P03_08 `"Had to pay a school fee"'
label variable P03_09 `"[Value] School fee"'

label values P03_10 dummy

label variable P03_10 `"Received school materials in the beginning of the year"'

label variable P03_11 `"School related costs: books"'
label variable P03_13 `"School related costs: school uniform"'
label variable P03_14 `"School related costs: exam material"'
label variable P03_12 `"School related costs: course material"'
label variable P03_15 `"School related costs: private classes"'
label variable P03_16 `"School related contributions: construction/renovation contribution in days"'
label variable P03_17 `"School related contributions: construction/renovation contribution in money"'
label variable P03_18 `"School related contributions: construction/renovation contribution in materials"'
label variable P03_19 `"School related contributions: other school initiatives contribution in money"'
label variable P03_20 `"School related contributions: other school initiatives contribution in materials"'

label values P03_21 freq1
label variable P03_21 `"Frequency last year: received school performance information about student"'

label values P03_22 freq1
label variable P03_22 `"Frequency last year: to school to talk to teacher"'

label values P03_23 freq1
label variable P03_23 `"Frequency last year: invited to talk to teacher"'

label values P03_24 freq1
label variable P03_24 `"Frequency last year: participated in general school meetings"'

label variable P03_25 `"Times last four weeks: received information about school performance student"'
label variable P03_26 `"Times last four weeks: talk to professor"'

label values P03_28 dummy
label variable P03_28 `"There is a parent committee"'

label values P03_29 appointment2
label variable P03_29 `"Parent committee selection"'

replace P03_29 = 1 if P03_29==3

drop P03_29_other

label values P03_30 dummy
label variable P03_30 `"Parent committee election voted"'

label values P03_31 dummy
label variable P03_31 `"Parent is committee member"'

label values P03_32 dummy
label variable P03_32 `"Parent is committee old member"'

label values P03_33 dummy

label variable P03_33 `"Parent committee: would like to be member"'
label variable P03_34 `"Parent committee coordinator name"'

replace P03_34="" if inlist(P03_34,"0","990","999")

drop P03_35__13
gen P03_35__13 = 0 if P03_35__1!=.
gen P03_35__14 = 0 if P03_35__1!=.
gen P03_35__15 = 0 if P03_35__1!=.

order P03_35__13 P03_35__14 P03_35__15, after(P03_35__12)

replace P03_35__4 = 1 if P03_35_other=="Discutir pontualidade dos alunos"
replace P03_35__5 = 1 if P03_35_other=="A falar sobre o bem estar das crianças na escola"
replace P03_35__10 = 1 if P03_35_other=="falar do melhoramento da estrutura da escola"
replace P03_35__10 = 1 if P03_35_other=="Falar sobre a distancia da escola"
replace P03_35__11 = 1 if P03_35_other=="Recolha de donativos"
replace P03_35__11 = 1 if P03_35_other=="Velar pela reparação da escola. velar pela comparticipação"
replace P03_35__13 = 1 if P03_35_other=="Aconselhar os outros pais"
replace P03_35__13 = 1 if P03_35_other=="Apelar aos pais à envolverem-se com a escola"
replace P03_35__13 = 1 if P03_35_other=="comunicar os encarregado de educação para falar da atividade da escola"
replace P03_35__13 = 1 if P03_35_other=="convida os pais e dá p orientação de como devem ser"
replace P03_35__13 = 1 if P03_35_other=="Discutir as responsabilidade dos paia"
replace P03_35__13 = 1 if P03_35_other=="Falar com os encarregado s a cerca da Higiene da escola"
replace P03_35__13 = 1 if P03_35_other=="Falar com os pais sobre os assuntos relacionados com a escola"
replace P03_35__13 = 1 if P03_35_other=="Garantir o Envolvimento dos Encarregados de Educação"
replace P03_35__13 = 1 if P03_35_other=="garantir o envolvimento dos pais"
replace P03_35__13 = 1 if P03_35_other=="notificar aos pais sempre que houver uma reunião"
replace P03_35__13 = 1 if P03_35_other=="Reportar problemas da escola aos encarregados"
replace P03_35__14 = 1 if P03_35_other=="ajudar a escola nas ações emergente"
replace P03_35__14 = 1 if P03_35_other=="Ajudar a escola no seu desenvolvimento"
replace P03_35__14 = 1 if P03_35_other=="Controlar a vida escolar"
replace P03_35__14 = 1 if P03_35_other=="controlar numero de alunos na escola"
replace P03_35__14 = 1 if P03_35_other=="Interagir com outras escolas"
replace P03_35__14 = 1 if P03_35_other=="participar nas Actividades programadas pela escola"
replace P03_35__14 = 1 if P03_35_other=="Praticamente controlo da escola..."
replace P03_35__14 = 1 if P03_35_other=="Reunir Quando Haver problema para ajudar a escola a resolver"
replace P03_35__14 = 1 if P03_35_other=="reparar a instituição, velar pela organização ds escola"
replace P03_35__15 = 1 if P03_35_other=="Cuidar da escola"
replace P03_35__15 = 1 if P03_35_other=="Portas estragadas"
replace P03_35__15 = 1 if P03_35_other=="Reparar os problemas fisicos da escola"
replace P03_35__15 = 1 if P03_35_other=="Vekar pela manutenção da escola"
replace P03_35__15 = 1 if P03_35_other=="Velar pela manutenção das carteiras"
replace P03_35__15 = 1 if P03_35_other=="Velar pelas condições da infra estrutura"
replace P03_35__15 = 1 if P03_35_other=="controlo de material como cartera e quadro, acompanhar os encarregado"
replace P03_35__15 = 1 if P03_35_other=="Velar pelos uniformes dos alunos"
replace P03_35__15 = 1 if P03_35_other=="Estado moral dos alunos e velar pela saude dos alunos"
replace P03_35__15 = 1 if P03_35_other=="Higiene"
replace P03_35__15 = 1 if P03_35_other=="Higiene"
replace P03_35__15 = 1 if P03_35_other=="Higiene das Crianças"
replace P03_35__15 = 1 if P03_35_other=="Limpeza"
replace P03_35__15 = 1 if P03_35_other=="Manter a higiene corporal dos alunos"
replace P03_35__15 = 1 if P03_35_other=="Velar pela Higiene da Escola"
replace P03_35__15 = 1 if P03_35_other=="Velar pela higiene dos alunos"
replace P03_35__15 = 1 if P03_35_other=="garantir a segurança das crianças na escola"
replace P03_35__15 = 1 if P03_35_other=="velar pela segurança da escola"
replace P03_35__15 = 1 if P03_35_other=="Garantir A merenda escolar, Através Da lavra escolar"

label variable P03_35__1 `"Parent committee responsibilities: Sugest changes in teaching subjects"'
label variable P03_35__2 `"Parent committee responsibilities: Sugest changes in teaching methods"'
label variable P03_35__3 `"Parent committee responsibilities: Discuss how public money should be spend"'
label variable P03_35__4 `"Parent committee responsibilities: Discuss absentism of students"'
label variable P03_35__5 `"Parent committee responsibilities: Discuss the performance of students"'
label variable P03_35__6 `"Parent committee responsibilities: Talk to teachers/director about absentism of teachers"'
label variable P03_35__7 `"Parent committee responsibilities: Talk to teachers/director about performance of teachers"'
label variable P03_35__8 `"Parent committee responsibilities: Report problems to school board"'
label variable P03_35__9 `"Parent committee responsibilities: Report problems to superior authorities"'
label variable P03_35__10 `"Parent committee responsibilities: Discuss and find solutions for infrastructure problems with parents and the board"'
label variable P03_35__11 `"Parent committee responsibilities: Collect money and materials from parents/community"'
label variable P03_35__12 `"Parent committee responsibilities: Discuss and encourage extracuricular activities with parents for students"'
label variable P03_35__13 `"Parent committee responsibilities: Discuss school matters with parents"'
label variable P03_35__14 `"Parent committee responsibilities: Support school management"'
label variable P03_35__15 `"Parent committee responsibilities: Maintenance of school facilities and infrastructures"'

drop P03_35__999 P03_35_other

label values P03_36 dummy
label variable P03_36 `"School board member"'

label values P03_37 dummy
label variable P03_37 `"School board old member"'

drop P03_38__17
gen P03_38__17 = 0 if P03_38__1!=.
order P03_38__17, after(P03_38__16)

replace P03_38__3 = 1 if P03_38_other=="Saber quem são os alunos, Transmitir comunicados aos Encarregados"
replace P03_38__4 = 1 if P03_38_other=="Saber quem são os alunos, Transmitir comunicados aos Encarregados"
replace P03_38__11 = 1 if P03_38_other=="Preocupar-se muito mais no processo de ensino e aprendizagem dos alunos."
replace P03_38__15 = 1 if P03_38_other=="Compras de msterias como carteiras etc"
replace P03_38__15 = 1 if P03_38_other=="Problemas de Água"
replace P03_38__15 = 1 if P03_38_other=="cuidar da Higiene"
replace P03_38__15 = 1 if P03_38_other=="Cuidar da higiene"
replace P03_38__15 = 1 if P03_38_other=="Manter a higiene da escola"
replace P03_38__15 = 1 if P03_38_other=="Velar pela higiene dos alunos"
replace P03_38__15 = 1 if P03_38_other=="Higiene,materiais de ensino"
replace P03_38__15 = 1 if P03_38_other=="Ofertar Material Didatico"
replace P03_38__15 = 1 if P03_38_other=="Pedir aos pais para cuidarem do material escolar dos alunos"
replace P03_38__15 = 1 if P03_38_other=="velar pelos materias didatico"
replace P03_38__17 = 1 if P03_38_other=="A direção tem de se dirigir na Administração"
replace P03_38__17 = 1 if P03_38_other=="melhorar o nivel da educação"
replace P03_38__17 = 1 if P03_38_other=="Controlar a escola"
replace P03_38__17 = 1 if P03_38_other=="Controlar a Escola"
replace P03_38__17 = 1 if P03_38_other=="dar resposta aos problemas da escola de forma geral"
replace P03_38__17 = 1 if P03_38_other=="Fazer cumprir"
replace P03_38__17 = 1 if P03_38_other=="supervisionar a escola"
replace P03_38__17 = 1 if P03_38_other=="Fazer o controlo do pessoal docente, fazer matrículas no tempo estabelecido"
replace P03_38__17 = 1 if P03_38_other=="matricular"
replace P03_38__17 = 1 if P03_38_other=="Matricular e colar pautas"
replace P03_38__17 = 1 if P03_38_other=="Publicar os resultados dos exames"

label variable P03_38__1 `"School board responsibilities: Decide how public money should be spend"'
label variable P03_38__2 `"School board responsibilities: Prepare a school development plan"'
label variable P03_38__3 `"School board responsibilities: Talk to parents about absentism of students"'
label variable P03_38__4 `"School board responsibilities: Talk to parents about the performance of students"'
label variable P03_38__5 `"School board responsibilities: Talk to teachers about their absentism"'
label variable P03_38__6 `"School board responsibilities: Talk to teachers about their performance"'
label variable P03_38__7 `"School board responsibilities: Discuss the option to dismiss a teacher"'
label variable P03_38__8 `"School board responsibilities: Report problems to superior authorities"'
label variable P03_38__9 `"School board responsibilities: Collect money and materials from parents/community"'
label variable P03_38__10 `"School board responsibilities: Sugest changes in teaching subjects"'
label variable P03_38__11 `"School board responsibilities: Sugest changes in teaching methods"'
label variable P03_38__12 `"School board responsibilities: Discuss topics brought forward by parents"'
label variable P03_38__13 `"School board responsibilities: Discuss topics brought forward by teachers"'
label variable P03_38__14 `"School board responsibilities: Decide who will be the new parent committee members"'
label variable P03_38__15 `"School board responsibilities: Maintenance of school facilities and infrastructures"'
label variable P03_38__16 `"School board responsibilities: Take care of school safety"'
label variable P03_38__17 `"School board responsibilities: Ensure general school functioning"'

drop P03_38__999 P03_38_other

lab val P03_35__1 P03_35__2 P03_35__3 P03_35__4 P03_35__5 P03_35__6 		///
	P03_35__7 P03_35__8 P03_35__9 P03_35__10 P03_35__11 P03_35__12 			///
	P03_35__13 P03_35__14 P03_35__15 P03_38__1 P03_38__2 P03_38__3 			///
	P03_38__4 P03_38__5 P03_38__6 P03_38__7 P03_38__8 P03_38__9 			///
	P03_38__10 P03_38__11 P03_38__12 P03_38__13 P03_38__14 P03_38__15 		///
	P03_38__16 P03_38__17 dummy


********************************************************************************

********************************************************************************

* Section 4 (P4 / T5 / D7)

// labelssss

#delimit ;
;
label define problem
0 `"Not a problem"'
1 `"Small problem"'
2 `"Average problem"'
3 `"Big problem"'
;
#delimit cr

foreach var in  P04_01__0 P04_01__1 P04_01__2 P04_01__3 P04_01__4 			///
	P04_01__5 P04_01__6 P04_01__7 P04_01__8 P04_01__9 P04_01__10 			///
	P04_01__11 P04_01__12 P04_01__13 P04_01__14 P04_01__15 P04_01__16 		///
	P04_01__17 P04_01__18 P04_01__19 P04_01__20 P04_01__21 P04_01__22 		///
	P04_01__999 P04_02__0 P04_02__1 P04_02__2 P04_02__3 P04_02__4 			///
	P04_02__5 P04_02__6 P04_02__7 P04_02__8 P04_02__9 P04_02__10 			///
	P04_02__11 P04_02__12 P04_02__13 P04_02__14 P04_02__15 P04_02__16 		///
	P04_02__17 P04_02__18 P04_02__19 P04_02__20 P04_02__21 P04_02__22 		///
	P04_02__23 P04_02__24 P04_02__25 P04_02__26 P04_02__27 P04_02__28 		///
	P04_02__29 P04_02__30 P04_02__31 P04_02__999 P04_03 P04_04 P04_05 		///
	P04_06 P04_07 P04_08 P04_09 P04_10 P04_11 P04_12 P04_13 P04_14 			///
	P04_15 P04_16 P04_17 P04_18 P04_19 P04_20 P04_21 P04_22 P04_23 			///
	P04_24 P04_25 P04_26 P04_27 P04_28 P04_29 P04_30 P04_31 P04_32 P04_33{
		replace `var' = . if inlist(`var',999,-999999999)
}

rename P04_01__22 P04_01__22_old

gen P04_01__22 = 0 if P04_01__1!=.
gen P04_01__23 = 0 if P04_01__1!=.

order P04_01__22 P04_01__23, after(P04_01__21)

replace P04_01__1 = P04_01__22_old if P04_01_other=="colocaram novo teto nas salas de aulas" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="colocaram portas nas salas de aula" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="compra de chapa para cobrir e contribuição" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="cuidaram do teto" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="Fizeram nova pintura e meteram moçaico" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="melhorou-se o teto das salas de aulas" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="trocaram as chapas de zinco." & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="trocaram as portas e janelas" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="Trocou-se as Portas" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="Pintaram as salas e colocaram novos barrotes ." & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="rebocaram salas e construíram anexos" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="Embelezamento da escola" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="melhorou na luz, pintura e instalações" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="meteram chão construiram sala dos professores" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="nova pintura" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="pintaram a escola e meteram mosaico nas turmas" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="Pintura" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="pintura da escola" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="Pintura da escola" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="Pintura da escola" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="Pintura e um fontenário." & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="repararam as escadas e escola" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="vedação dos muros e meteram chão nas salas de aulas" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="melhoraram a pintura da escola" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="Melhorou a iluminação e contratou se imprega de limpeza" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="Melhorou a infra estrutura" & P04_01__1 == 0
replace P04_01__1 = P04_01__22_old if P04_01_other=="A mudança do tecto da escola" & P04_01__1 == 0
replace P04_01__2 = P04_01__22_old if P04_01_other=="Pintaram as salas e colocaram novos barrotes ." & P04_01__2 == 0
replace P04_01__2 = P04_01__22_old if P04_01_other=="rebocaram salas e construíram anexos" & P04_01__2 == 0
replace P04_01__2 = P04_01__22_old if P04_01_other=="Aumentaram os Jango de chapa" & P04_01__2 == 0
replace P04_01__2 = P04_01__22_old if P04_01_other=="Fabricaram adobes, e contribuiram um valor e posteriormente  para comprar chapas." & P04_01__2 == 0
replace P04_01__2 = P04_01__22_old if P04_01_other=="Melhorar a pintura e comprar novas chapas" & P04_01__2 == 0
replace P04_01__4 = P04_01__22_old if P04_01_other=="indireitou-se escada, casa de banho" & P04_01__4 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="compraram chave, rebocaram a sala de professor" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="Embelezamento da escola" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="melhorou na luz, pintura e instalações" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="meteram chão construiram sala dos professores" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="nova pintura" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="pintaram a escola e meteram mosaico nas turmas" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="Pintura" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="pintura da escola" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="Pintura da escola" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="Pintura da escola" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="Pintura e um fontenário." & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="repararam as escadas e escola" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="melhoraram a pintura da escola" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="Melhorou a infra estrutura" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="meteram de graus" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="indireitou-se escada, casa de banho" & P04_01__5 == 0
replace P04_01__5 = P04_01__22_old if P04_01_other=="A mudança do tecto da escola" & P04_01__5 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="vedação dos muros e meteram chão nas salas de aulas" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="Construção da sala dos professores e gabinete do direitor ..." & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="construção de casa de professores" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="Construção do muro" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="construção do muro, e portão." & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="construção do Quintal" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="construção do Quintal" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="Construi-se campo de vedação" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="construiram casa dos professores" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="construíram casa dos professores" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="Construíram muro" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="construíram o muro da escola" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="entulharam a escola para evitar as inundações" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="gabinete" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="gabinete do director" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="Gabinete do Direitor" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="Sala dos professores, secretaria etc...." & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="sercaram o pátio da escola" & P04_01__6 == 0
replace P04_01__6 = P04_01__22_old if P04_01_other=="vedação dos muros" & P04_01__6 == 0
replace P04_01__7 = P04_01__22_old if P04_01_other=="Melhorou as Carteira" & P04_01__7 == 0
replace P04_01__7 = P04_01__22_old if P04_01_other=="Recuperaram as carteira roubadas" & P04_01__7 == 0
replace P04_01__7 = P04_01__22_old if P04_01_other=="Energia, carteiras,aguá....." & P04_01__7 == 0
replace P04_01__8 = P04_01__22_old if P04_01_other=="Materiais escolares" & P04_01__8 == 0
replace P04_01__8 = P04_01__22_old if P04_01_other=="Mobília" & P04_01__8 == 0
replace P04_01__8 = P04_01__22_old if P04_01_other=="Novos Quadros e Carteiras" & P04_01__8 == 0
replace P04_01__8 = P04_01__22_old if P04_01_other=="portas e fechaduras compradas pelos encarregados, carteiras" & P04_01__8 == 0
replace P04_01__8 = P04_01__22_old if P04_01_other=="portas e janelas" & P04_01__8 == 0
replace P04_01__14 = P04_01__22_old if P04_01_other=="os professores estão estudar e superando-se dia pois." & P04_01__14 == 0
replace P04_01__17 = P04_01__22_old if P04_01_other=="Acompanhamento de perto de perto aos alunos" & P04_01__17 == 0
replace P04_01__17 = P04_01__22_old if P04_01_other=="Melhorou o desempenho do director" & P04_01__17 == 0
replace P04_01__17 = P04_01__22_old if P04_01_other=="Novo Director" & P04_01__17 == 0
replace P04_01__17 = P04_01__22_old if P04_01_other=="organização da escola" & P04_01__17 == 0
replace P04_01__17 = P04_01__22_old if P04_01_other=="A participação do diretor e abertura do dialogo com os paid" & P04_01__17 == 0
replace P04_01__18 = P04_01__22_old if P04_01_other=="Ajuda dos professores estagiários" & P04_01__18 == 0
replace P04_01__18 = P04_01__22_old if P04_01_other=="Número de professores estagiários" & P04_01__18 == 0
replace P04_01__20 = P04_01__22_old if P04_01_other=="Melhorou a iluminação e contratou se imprega de limpeza" & P04_01__20 == 0
replace P04_01__21 = P04_01__22_old if P04_01_other=="Construção em curso de nova escola" & P04_01__21 == 0
replace P04_01__21 = P04_01__22_old if P04_01_other=="Construção em curso duma escola nova" & P04_01__21 == 0
replace P04_01__21 = P04_01__22_old if P04_01_other=="Está em construção de uma nova escola" & P04_01__21 == 0
replace P04_01__21 = P04_01__22_old if P04_01_other=="Estalação da Escola" & P04_01__21 == 0
replace P04_01__21 = P04_01__22_old if P04_01_other=="Robocaram A escola" & P04_01__21 == 0
replace P04_01__21 = P04_01__22_old if P04_01_other=="Uma nova escola em construção" & P04_01__21 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="A instalação de emergia Solar" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="A instalação eléctrica" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="A ligação da energia" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="A ligação da energia" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Comprou-se um girador" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Contribuição da Luz" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Corrente Elétrica" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="energia" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="energia" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Energia" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="energia" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="energia eléctrica" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="energia eléctrica" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="energia eléctrica" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Energia Solar" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Escola tem luz elétrica" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Instalação de energia solar" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Instalação Eléctrica" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Instalaram electricidade na escola" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="agua e energia" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="A escola tem água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Agua" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Água canalizada" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="construíram um tanque de água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Constução de um Chafaris" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Melhorou a instalação eléctrica Luz" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Melhorou água e luz" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Canalização da água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Canalização de água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Canalizaram a água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Melhorou as condições da água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Melhorou o abastecimento ds água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Melhorou o meio de obter água, a manivela" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="merenda escolar, aquisição de um gerador e água" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="água, aulas noctunas e menda escolar" & P04_01__22 == 0
replace P04_01__22 = P04_01__22_old if P04_01_other=="Energia, carteiras,aguá....." & P04_01__22 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="Deram merenda escolar" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="Emplementação da merenda escolar" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="Merenda escolar" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="merenda escolar" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="merenda escolar" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="merenda escolar" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="Merenda escolar" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="merenda escolar" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="Merenda escolar  no ano passado" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="Puseram merenda escolar" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="merenda escolar, aquisição de um gerador e água" & P04_01__23 == 0
replace P04_01__23 = P04_01__22_old if P04_01_other=="água, aulas noctunas e menda escolar" & P04_01__23 == 0


label variable P04_01__1 `"(ordered) Achievements: Improved classrooms"'
label variable P04_01__2 `"(ordered) Achievements: Build new classrooms"'
label variable P04_01__3 `"(ordered) Achievements: Improved bathrooms"'
label variable P04_01__4 `"(ordered) Achievements: Build new bathrooms"'
label variable P04_01__5 `"(ordered) Achievements: Improved other facilities (e.g.: field, fence, library)"'
label variable P04_01__6 `"(ordered) Achievements: Build new other facilities (e.g.: field, fence, library)"'
label variable P04_01__7 `"(ordered) Achievements: Improved school material and furniture"'
label variable P04_01__8 `"(ordered) Achievements: Bought new school material and furniture"'
label variable P04_01__9 `"(ordered) Achievements: Encouraged/organized extracurricular activities"'
label variable P04_01__10 `"(ordered) Achievements: Student test results improved"'
label variable P04_01__11 `"(ordered) Achievements: Overal student performance improved"'
label variable P04_01__12 `"(ordered) Achievements: Reducerd student absentism"'
label variable P04_01__13 `"(ordered) Achievements: Reducerd student drop-out rate"'
label variable P04_01__14 `"(ordered) Achievements: Teacher performance improved"'
label variable P04_01__15 `"(ordered) Achievements: Reducerd teacher absentism"'
label variable P04_01__16 `"(ordered) Achievements: Teacher conditions improved (salary, housing, transport)"'
label variable P04_01__17 `"(ordered) Achievements: Managment / Administration improved"'
label variable P04_01__18 `"(ordered) Achievements: Number of teachers increased"'
label variable P04_01__19 `"(ordered) Achievements: Parental involvement increased"'
label variable P04_01__20 `"(ordered) Achievements: Contracted cleaning staff"'
label variable P04_01__21 `"(ordered) Achievements: Contracted security staff"'
label variable P04_01__22 `"(ordered) Achievements: New school under construction"'
label variable P04_01__23 `"(ordered) Achievements: Water / electicity improvements"'

drop P04_01__0 P04_01__999 P04_01_other P04_01__22_old

rename P04_02__31 P04_02__31_old

gen P04_02__31 = 0 if P04_02__1!=.
gen P04_02__32 = 0 if P04_02__1!=.
gen P04_02__33 = 0 if P04_02__1!=.
gen P04_02__34 = 0 if P04_02__1!=.
gen P04_02__35 = 0 if P04_02__1!=.

order P04_02__31 P04_02__32 P04_02__33 P04_02__34 P04_02__35, after(P04_02__30)

replace P04_02__1 = P04_02__31_old if P04_02_other=="Falta de residência dos  professores,Excesso de Alunos nas salas de aula" & P04_02__1 == 0
replace P04_02__2 = P04_02__31_old if P04_02_other=="requalificação da escola, rendo mas sala, carteira" & P04_02__2 == 0
replace P04_02__2 = P04_02__31_old if P04_02_other=="Falta de salas e com qualidade" & P04_02__2 == 0
replace P04_02__3 = P04_02__31_old if P04_02_other=="A Falta de professor" & P04_02__3 == 0
replace P04_02__3 = P04_02__31_old if P04_02_other=="aumentou número de professores devido os estagiários" & P04_02__3 == 0
replace P04_02__3 = P04_02__31_old if P04_02_other=="Falta de professores" & P04_02__3 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="requalificação da escola, rendo mas sala, carteira" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Falta de salas e com qualidade" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="A mal condições que as sala de aulas apresenta" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="A mal conservação das carteiras" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Falta de portas na sala de aula" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Fissuras nas paredes" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Melhoramento do jamngo" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="melhorar as salas anexas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="pintar as salas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Teto em maus condições, isto é, qdo chove, entra agua nas salas de aula" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Teto em maus condições, Permitindo assim entradas de agua quando chove" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Teto falso em maus condições, fazendo com que n tempo de chuva entra agua , nas salas de aula" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Teto falso em maus qualidades" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Turmas cem porta" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="A estrutura da escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="A mal condição que a escola apresenta" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="aspecto da escola, hospital" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Carteiras,luz etc...." & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Construção de nova escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="construção de nova escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="construção de nova escopa de raiz e impedir que os alunos desloncam de um bairro ao outro com grande distância" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Construção de outra escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Construção de uma nova escola, bem equipada" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Construção de uma nova escola, bem equipada" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Construir uma nova escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="entra aguá nas salas de aulas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="estrutura da escola em si" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Falta de escola definitiva e apetrechado" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="falta fechadura, portas e janelas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="falta pintar a escola e ver as questões das chapas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Falta pintar, porta, carteiras e fechaduras" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Inundações" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Inundações" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Inundações no tempo chuvoso" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Manuntenção da escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="no tempo de chuva as crianças não vão a escola porque entra muita água" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="no tempo de chuva entra água nas salas de aula" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="o estado de degradação da estrutura da escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="O mal estado em que a escola se encontra" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="péssimas condições de trabalho" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Reabilitação da escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Reabilitação da escola em Geral" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="reabilitação e apetrechamento da escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="reabilitação e construção de uma nova escola e apetrechado" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="reabilitação, apetrechamento e construção de mas escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="reabilitar e apetrechar a escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="renovar a pintura da escola...." & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="reparação da escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Reparar o tecto falso, reparacao da escola." & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Restruturação da escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Restruturação da escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="tempo chuvosos inundações" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Pavimentar o espaco escolar, melhorar a escada que da acesso a escola." & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="pintura da escola, falta de portas e janelas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="chapa, porta e janelas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="colocar algumas janelas e portas." & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Falta de Janelas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="janelas, portas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="melhorar as Janelas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Pintura na escola" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Porta e Janelas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Portas danigicadas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Portas e janelas, e professores" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Portas estragadas" & P04_02__4 == 0
replace P04_02__4 = P04_02__31_old if P04_02_other=="Portas, Portão e Janelas" & P04_02__4 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Falta de residência dos  professores,Excesso de Alunos nas salas de aula" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="A falta de vedação do murro da escola" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="a falta do quintal" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="cantina" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="casa para os professor." & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="casa para os professores." & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="contrução do quintal da escolha" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Falta da vedação da escola" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Falta de campo multiuso" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Falta de campos multiusos" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Falta de Muro" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="falta de um campo multi uso" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Falta de um campo multiuso" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="falta de vedação do Quintal da escola" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="falta de vedação dos muros" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="falta residência do progessores" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Gabinete dos professores" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="laboratório de informática" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Melhorar o acesso a entrada da escola" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="O pátio da escola" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Posto sanitário" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Vedação" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Vedação da escola" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="vedação dos muros" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="vedação dos muros ou seja meter quintal" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Vedação e portas para salas de aulas" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Vedacção" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="cozinha escolar,muro da escola" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Melhorar o espaço verde. Merenda escolar" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="organizar janelas, portas, fechaduras e casa para professores" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Construção de um posto medico para escola" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="hospital" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="posto medico e enfermeiro" & P04_02__6 == 0
replace P04_02__6 = P04_02__31_old if P04_02_other=="Posto medico." & P04_02__6 == 0
replace P04_02__11 = P04_02__31_old if P04_02_other=="Conflitos entre alunos" & P04_02__11 == 0
replace P04_02__11 = P04_02__31_old if P04_02_other=="conflitos físicos entre os alunos" & P04_02__11 == 0
replace P04_02__14 = P04_02__31_old if P04_02_other=="Ausência dos Pais e a não comparticipação" & P04_02__14 == 0
replace P04_02__16 = P04_02__31_old if P04_02_other=="assiduidade dos professor" & P04_02__16 == 0
replace P04_02__17 = P04_02__31_old if P04_02_other=="Há Um Professor que não a aparece a um mês" & P04_02__17 == 0
replace P04_02__17 = P04_02__31_old if P04_02_other=="Ausência constante dos professores" & P04_02__17 == 0
replace P04_02__19 = P04_02__31_old if P04_02_other=="A codificação da matéria a ser lecionada" & P04_02__19 == 0
replace P04_02__19 = P04_02__31_old if P04_02_other=="Melhorar a qualidade de ensino" & P04_02__19 == 0
replace P04_02__19 = P04_02__31_old if P04_02_other=="Melhoria do comportamento de alguns professores." & P04_02__19 == 0
replace P04_02__19 = P04_02__31_old if P04_02_other=="melhoria do ensino por parte dos professores." & P04_02__19 == 0
replace P04_02__19 = P04_02__31_old if P04_02_other=="Melhoria dos meios de ensino." & P04_02__19 == 0
replace P04_02__19 = P04_02__31_old if P04_02_other=="Qualidade de ensino" & P04_02__19 == 0
replace P04_02__26 = P04_02__31_old if P04_02_other=="falta de cadeiras." & P04_02__26 == 0
replace P04_02__26 = P04_02__31_old if P04_02_other=="Mobiliário escolar" & P04_02__26 == 0
replace P04_02__27 = P04_02__31_old if P04_02_other=="Falta de material de ensino" & P04_02__27 == 0
replace P04_02__28 = P04_02__31_old if P04_02_other=="Vandalismos por parte dos moradores" & P04_02__28 == 0
replace P04_02__30 = P04_02__31_old if P04_02_other=="tratamento da água, aproximação da escola com a estrada preocupa os encarregados" & P04_02__30 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="Falta da merenda escolar" & P04_02__31 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="Falta de Marenda escolar" & P04_02__31 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="falta de merenda escolar" & P04_02__31 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="Falta de Merenda escolar" & P04_02__31 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="Fslta de merenda escolar" & P04_02__31 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="Higiene" & P04_02__31 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="merenda" & P04_02__31 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="merenda escolar" & P04_02__31 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="Merenda escolar" & P04_02__31 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="Merenda Escolar" & P04_02__31 == 0
replace P04_02__31 = P04_02__31_old if P04_02_other=="Falta de merenda e Transporte" & P04_02__31 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="Falta de merenda e Transporte" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="A escola esta mal situada porque se encontra  ao lado  estrada principal" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="Distância" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="Distância da Escola" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="Distância do local de resistência até a escola..." & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="Esta mal localizada por estar perto do rio" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="falta de transporte" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="Falta de transporte" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="localização da escola" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="Meio de transporte" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="proximidade com a estrada" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="terreno da escola (localizaçao da escola)" & P04_02__32 == 0
replace P04_02__32 = P04_02__31_old if P04_02_other=="Transporte" & P04_02__32 == 0
replace P04_02__33 = P04_02__31_old if P04_02_other=="Aumento da propina" & P04_02__33 == 0
replace P04_02__33 = P04_02__31_old if P04_02_other=="pagamento de propinas é muito alto" & P04_02__33 == 0
replace P04_02__33 = P04_02__31_old if P04_02_other=="pagamentos de propinas." & P04_02__33 == 0
replace P04_02__33 = P04_02__31_old if P04_02_other=="Pagar propina" & P04_02__33 == 0
replace P04_02__33 = P04_02__31_old if P04_02_other=="Pede muito dinheiro" & P04_02__33 == 0
replace P04_02__33 = P04_02__31_old if P04_02_other=="propina alta" & P04_02__33 == 0
replace P04_02__33 = P04_02__31_old if P04_02_other=="Suspender ou não assistir aulas o por falta de pagamento" & P04_02__33 == 0
replace P04_02__33 = P04_02__31_old if P04_02_other=="taixa de comparticipação alta" & P04_02__33 == 0
replace P04_02__34 = P04_02__31_old if P04_02_other=="Auxiliar de Limpeza" & P04_02__34 == 0
replace P04_02__34 = P04_02__31_old if P04_02_other=="auxiliar de limpeza" & P04_02__34 == 0
replace P04_02__34 = P04_02__31_old if P04_02_other=="Falta contina" & P04_02__34 == 0
replace P04_02__34 = P04_02__31_old if P04_02_other=="Falta d auxiliar d limpeza" & P04_02__34 == 0
replace P04_02__34 = P04_02__31_old if P04_02_other=="Falta de auxiliar da limpeza" & P04_02__34 == 0
replace P04_02__34 = P04_02__31_old if P04_02_other=="Falta de auxiliar de limpeza" & P04_02__34 == 0
replace P04_02__34 = P04_02__31_old if P04_02_other=="falta de auxiliar de limpeza" & P04_02__34 == 0
replace P04_02__34 = P04_02__31_old if P04_02_other=="Falta de Contina" & P04_02__34 == 0
replace P04_02__34 = P04_02__31_old if P04_02_other=="falta de empregada de limpeza" & P04_02__34 == 0
replace P04_02__34 = P04_02__31_old if P04_02_other=="Falta empregada de limpeza" & P04_02__34 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="aumentar o nível da escola para primeiro ciclo" & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="A falta do II nível" & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="Aumento de classe para evitar a deslocamento para a comuna sede" & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="aumento de outras classe como 7;8;9" & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="construção de escolas de outros ciclos" & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="construção de escolas do I e Ii ciclo" & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="falta de escola para classes seguintes  e próximo porque as crianças percorrem longas distancias." & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="falta de escolas de outros ciclos" & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other==`"Falta implementação da "Sexta Classe" nesta escola"' & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="Em todas idades oportunidade a acesso a escola" & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="Falta de aulas a noite" & P04_02__35 == 0
replace P04_02__35 = P04_02__31_old if P04_02_other=="Falta de oportunidade para alunos do sistema de Adulto" & P04_02__35 == 0

label variable P04_02__1 `"(ordered) Problem: Too many students per class"'
label variable P04_02__2 `"(ordered) Problem: Not enough classrooms"'
label variable P04_02__3 `"(ordered) Problem: Not enough teachers"'
label variable P04_02__4 `"(ordered) Problem: Low quality of the classrooms (school in general)"'
label variable P04_02__5 `"(ordered) Problem: Low quality or missing bathrooms"'
label variable P04_02__6 `"(ordered) Problem: Low quality or missing other facilities"'
label variable P04_02__7 `"(ordered) Problem: Weak health of students"'
label variable P04_02__8 `"(ordered) Problem: Students not complying with the schedule"'
label variable P04_02__9 `"(ordered) Problem: Student absence"'
label variable P04_02__10 `"(ordered) Problem: High drop out rate of students"'
label variable P04_02__11 `"(ordered) Problem: Misconduct and physical conflicts between students"'
label variable P04_02__12 `"(ordered) Problem: Student empathy towards teachers"'
label variable P04_02__13 `"(ordered) Problem: Students disrespect towards teachers"'
label variable P04_02__14 `"(ordered) Problem: Lack of parent involvement"'
label variable P04_02__15 `"(ordered) Problem: Unpreparedness of school team"'
label variable P04_02__16 `"(ordered) Problem: Teachers not complying with the schedule"'
label variable P04_02__17 `"(ordered) Problem: Teacher absence"'
label variable P04_02__18 `"(ordered) Problem: Low teacher salary"'
label variable P04_02__19 `"(ordered) Problem: Low teacher performance"'
label variable P04_02__20 `"(ordered) Problem: Low teacher motivation"'
label variable P04_02__21 `"(ordered) Problem: Too small school budget"'
label variable P04_02__22 `"(ordered) Problem: Teachers give private classes"'
label variable P04_02__23 `"(ordered) Problem: High cost of school material"'
label variable P04_02__24 `"(ordered) Problem: Automatic transition to higher class in the end of the year"'
label variable P04_02__25 `"(ordered) Problem: Lack of extracurricular activities"'
label variable P04_02__26 `"(ordered) Problem: Lack of furniture"'
label variable P04_02__27 `"(ordered) Problem: Lack of school material"'
label variable P04_02__28 `"(ordered) Problem: Lack of security"'
label variable P04_02__29 `"(ordered) Problem: Lack of electricity and light"'
label variable P04_02__30 `"(ordered) Problem: Lack of water"'
label variable P04_02__31 `"(ordered) Problem: Lack of school meal"'
label variable P04_02__32 `"(ordered) Problem: School location (distance / no transport)"'
label variable P04_02__33 `"(ordered) Problem: School fee"'
label variable P04_02__34 `"(ordered) Problem: Lack of cleaning staff"'
label variable P04_02__35 `"(ordered) Problem: Lack of grades and night classes"'

drop P04_02__0 P04_02__31_old P04_02__999 P04_02_other

rename P04_33 P04_33_old

gen P04_33 = 0 if P04_33_old!=.
gen P04_34 = 0 if P04_33_old!=.
gen P04_35 = 0 if P04_33_old!=.

order P04_33 P04_34 P04_35, after(P04_32)

replace P04_04 = 2 if P04_04==0 & P04_33_problem=="construção de mais salas de aula"
replace P04_04 = 2 if P04_04==0 & P04_33_problem=="construção de mais salas de aula"
replace P04_04 = 2 if P04_04==0 & P04_33_problem=="Construções definitivas de salas de aulas"
replace P04_04 = 2 if P04_04==0 & P04_33_problem=="poucas Salas de aulas"
replace P04_04 = 2 if P04_04==0 & P04_33_problem=="construção de uma escola e permitir que o governo dê atenção a esta escola porque os pais é que tem dado atenção. Falta quase tudo e uma escola de 6 salas no mínimo"
replace P04_04 = 2 if P04_04==0 & P04_33_problem=="A falta de uma escola maior"
replace P04_04 = 2 if P04_04==0 & P04_33_problem=="Falta de cobertura no teto da escola, Escola pequena"
replace P04_06 = 2 if P04_06==0 & P04_33_problem=="A falta de climatização das salas de aulas"
replace P04_06 = 2 if P04_06==0 & P04_33_problem=="Chapa e barrotes"
replace P04_06 = 2 if P04_06==0 & P04_33_problem=="Chapa quando chove molha tanto porque ja esta antiga, falta de fechaduras, falta de portas e janelas"
replace P04_06 = 2 if P04_06==0 & P04_33_problem=="Falta reabilitar a escola"
replace P04_06 = 2 if P04_06==0 & P04_33_problem=="Melhorar a escola"
replace P04_06 = 2 if P04_06==0 & P04_33_problem=="Pintura"
replace P04_07 = 2 if P04_07==0 & P04_33_problem=="Casas de Banho"
replace P04_07 = 2 if P04_07==0 & P04_33_problem=="Falta de Casas de banho"
replace P04_07 = 2 if P04_07==0 & P04_33_problem=="Falta de posto sanitário"
replace P04_07 = 2 if P04_07==0 & P04_33_problem=="Os alunos não fazem o uso das casas de banho da escola"
replace P04_08 = 2 if P04_08==0 & P04_33_problem=="A falta de um campo para desporto e ginastica"
replace P04_08 = 2 if P04_08==0 & P04_33_problem=="A falta de uma vedação segura"
replace P04_08 = 2 if P04_08==0 & P04_33_problem=="Espaço para educação física"
replace P04_08 = 2 if P04_08==0 & P04_33_problem=="falta de morro na escola"
replace P04_08 = 2 if P04_08==0 & P04_33_problem=="Falta de Muro"
replace P04_08 = 2 if P04_08==0 & P04_33_problem=="portas, janelas, fechaduras, casa para professores,"
replace P04_19 = 2 if P04_19==0 & P04_33_problem=="Ausência de uma professora"
replace P04_20 = 2 if P04_20==0 & P04_33_problem=="valorização do quadro docente"
replace P04_29 = 2 if P04_29==0 & P04_33_problem=="Falta de material desportivo como bolas"
replace P04_30 = 2 if P04_30==0 & P04_33_problem=="falta de guarda"
replace P04_32 = 2 if P04_32==0 & P04_33_problem=="Reabilitação do Tanque de Água"
replace P04_32 = 2 if P04_32==0 & P04_33_problem=="Falta de enfermeiro para o posto que esta fechado"
replace P04_32 = 2 if P04_32==0 & P04_33_problem=="Precisam de posto médico"
replace P04_33 = 2 if P04_33==0 & P04_33_problem=="Falra de merenda escolar"
replace P04_33 = 2 if P04_33==0 & P04_33_problem=="falta de merenda escolar"
replace P04_34 = 2 if P04_34==0 & P04_33_problem=="A escola está muito distante do bairro"
replace P04_34 = 2 if P04_34==0 & P04_33_problem=="Distância que as crianças percorrem"
replace P04_34 = 2 if P04_34==0 & P04_33_problem=="distsncia daescola do bairro"
replace P04_34 = 2 if P04_34==0 & P04_33_problem=="estrada, rede de telefonia"
replace P04_34 = 2 if P04_34==0 & P04_33_problem=="Falta de meios de transporte"
replace P04_34 = 2 if P04_34==0 & P04_33_problem=="Falta de segurança no caminho de casa para escola"
replace P04_35 = 2 if P04_35==0 & P04_33_problem=="A falta de empregas de limpeza"
replace P04_35 = 2 if P04_35==0 & P04_33_problem=="Falta de auxiliar de limpeza, falta de professor, mais sala de aulas"

label variable P04_03 `"Problem: Too many students per class"'
label variable P04_04 `"Problem: Not enough classrooms"'
label variable P04_05 `"Problem: Not enough teachers"'
label variable P04_06 `"Problem: Low quality of the classrooms"'
label variable P04_07 `"Problem: Low quality or missing bathrooms"'
label variable P04_08 `"Problem: Low quality or missing other facilities"'
label variable P04_09 `"Problem: Weak health of students"'
label variable P04_10 `"Problem: Students not complying with the schedule"'
label variable P04_11 `"Problem: Student absence"'
label variable P04_12 `"Problem: High drop out rate of students"'
label variable P04_13 `"Problem: Misconduct and physical conflicts between students"'
label variable P04_14 `"Problem: Student empathy towards teachers"'
label variable P04_15 `"Problem: Students disrespect towards teachers"'
label variable P04_16 `"Problem: Lack of parent involvement"'
label variable P04_17 `"Problem: Unpreparedness of school team"'
label variable P04_18 `"Problem: Teachers not complying with the schedule"'
label variable P04_19 `"Problem: Teacher absence"'
label variable P04_20 `"Problem: Low teacher salary"'
label variable P04_21 `"Problem: Low teacher performance"'
label variable P04_22 `"Problem: Low teacher motivation"'
label variable P04_23 `"Problem: Too small school budget"'
label variable P04_24 `"Problem: Teachers give private classes"'
label variable P04_25 `"Problem: High cost of school material"'
label variable P04_26 `"Problem: Automatic transition to higher class in the end of the year"'
label variable P04_27 `"Problem: Lack of extracurricular activities"'
label variable P04_28 `"Problem: Lack of furniture"'
label variable P04_29 `"Problem: Lack of school material"'
label variable P04_30 `"Problem: Lack of security"'
label variable P04_31 `"Problem: Lack of electricity and light"'
label variable P04_32 `"Problem: Lack of water"'
label variable P04_33 `"Problem: Lack of school meal"'
label variable P04_34 `"Problem: School location (distance / no transport)"'
label variable P04_35 `"Problem: Lack of cleaning staff"'

drop P04_33_old P04_33_problem

lab val P04_03 P04_04 P04_05 P04_06 P04_07 P04_08 P04_09 P04_10 P04_11 		///
		P04_12 P04_13 P04_14 P04_15 P04_16 P04_17 P04_18 P04_19 P04_20 		///
		P04_21 P04_22 P04_23 P04_24 P04_25 P04_26 P04_27 P04_28 P04_29 		///
		P04_30 P04_31 P04_32 P04_33 P04_34 P04_35 problem

********************************************************************************

********************************************************************************

* Section 5 (P5 / T6 / D8)

rename P05_01__18 P05_01__18_old

gen P05_01__18 = 0 if P05_01__18_old!=.

order P05_01__18, after(P05_01__17)

replace P05_01__2 = P05_01__18_old if P05_01_other=="Acabamento da escola e outro fica no stock" & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="Comprar chaves e fechaduras" & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="Organizar as portas e janelas...." & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="pintar a escola antiga e apetrechado" & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="Mudar a pintura da escola." & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="Nova pintura da escola e reparação das portas" & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="pintar a escola, melhorar as janelas" & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="pintura da escola,ver o problema do teto" & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="reabilitação da escola" & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="Reparação da escola" & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="Rever o teto da escola" & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="reabilitação da escola, aumentar mas escolas" & P05_01__2 == 0
replace P05_01__2 = P05_01__18_old if P05_01_other=="Pintar e colocar portas, janelas e fechaduras" & P05_01__2 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="avedacão do quintal da escola" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="avedação do quintal da escola" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Casa dos Professores" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="casa para os professores" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="casa para os professores e ter escolas proximas de cada zona para as crianças não andarem muito" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Construção da residência dos professores" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="construção de uma cantina escolar" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Construção do pátio" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="construção do quintal da escola" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Criação de um espaço verde." & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="criar um espaço verdejante e ver a questão da administração" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Melhorar as condições na casa dos professores" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Pátio para escola" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Por Jardim" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Residência dos Professores" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Residência dos professores" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Residência dos professores" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="residência para professores" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="vedação da escola" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="vedação dos muros" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="vedação dos muros" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="vedação dos muros" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Luz,agua posto Médico" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="comprava a aparelho de ar condicionado" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Criar mecanismo para uma sala de informática" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Construção de um posto de saúde" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="construção de um posto de saúde." & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Construção de um posto sanitário" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="hospital" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Hospital" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="posto de saúde" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="posto médico" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="posto médico" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Saúde dos alunos" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Um posto de saúde próximo a escola" & P05_01__4 == 0
replace P05_01__4 = P05_01__18_old if P05_01_other=="Estrada" & P05_01__4 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="Abastecimento de agua" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="aguá" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="Agua e Luz" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="Água, e luz" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="canalização da escola" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="colocaria água" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="Compra de um gerador para luz eléctrica" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="comprava um gerador" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="Construia um tanque de Angua" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="Electricidade" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="energia e Água" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="energia e água" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="Luz e água" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="Luz ou Energia" & P05_01__5 == 0
replace P05_01__5 = P05_01__18_old if P05_01_other=="Luz,agua posto Médico" & P05_01__5 == 0
replace P05_01__6 = P05_01__18_old if P05_01_other=="Compra de carteira" & P05_01__6 == 0
replace P05_01__6 = P05_01__18_old if P05_01_other=="Compra de carteiras" & P05_01__6 == 0
replace P05_01__6 = P05_01__18_old if P05_01_other=="Compra de computador" & P05_01__6 == 0
replace P05_01__6 = P05_01__18_old if P05_01_other=="compra de mobília" & P05_01__6 == 0
replace P05_01__6 = P05_01__18_old if P05_01_other=="Comprava mais carteiras,  mais chapas para tectuar outras escolas..." & P05_01__6 == 0
replace P05_01__7 = P05_01__18_old if P05_01_other=="Comprava Material Escolar" & P05_01__7 == 0
replace P05_01__9 = P05_01__18_old if P05_01_other=="Merenda  para a escola" & P05_01__9 == 0
replace P05_01__11 = P05_01__18_old if P05_01_other=="contrataria mais professor" & P05_01__11 == 0
replace P05_01__11 = P05_01__18_old if P05_01_other=="Aumento de mais professores" & P05_01__11 == 0
replace P05_01__13 = P05_01__18_old if P05_01_other=="Professores Qualificados" & P05_01__13 == 0
replace P05_01__14 = P05_01__18_old if P05_01_other=="ter segurança e colocar os meios de controle sofisticado porque tem aparecido bandidos vestido de aluno" & P05_01__14 == 0
replace P05_01__17 = P05_01__18_old if P05_01_other=="Meio de transporte" & P05_01__17 == 0
replace P05_01__18 = P05_01__18_old if P05_01_other=="Acabamento da escola e outro fica no stock" & P05_01__18 == 0
replace P05_01__18 = P05_01__18_old if P05_01_other=="Caixa para fazer poupança" & P05_01__18 == 0
replace P05_01__18 = P05_01__18_old if P05_01_other=="evitar as contribuição" & P05_01__18 == 0
replace P05_01__18 = P05_01__18_old if P05_01_other=="Reserva" & P05_01__18 == 0


label variable P05_01__1 `"Budget priorities: Build new school"'
label variable P05_01__2 `"Budget priorities: Build/improve classrooms"'
label variable P05_01__3 `"Budget priorities: Build/improve bathrooms"'
label variable P05_01__4 `"Budget priorities: Build/improve other facilities"'
label variable P05_01__5 `"Budget priorities: Build/improve water/electricity"'
label variable P05_01__6 `"Budget priorities: Buy/maintain furniture"'
label variable P05_01__7 `"Budget priorities: Buy school material"'
label variable P05_01__8 `"Budget priorities: Increase the number class periods"'
label variable P05_01__9 `"Budget priorities: Provide school meals"'
label variable P05_01__10 `"Budget priorities: Organize extracuricular activities"'
label variable P05_01__11 `"Budget priorities: Contract more teachers"'
label variable P05_01__12 `"Budget priorities: Increase teacher salary"'
label variable P05_01__13 `"Budget priorities: Invest in teacher education"'
label variable P05_01__14 `"Budget priorities: Contract security staff"'
label variable P05_01__15 `"Budget priorities: Contract cleaning staff"'
label variable P05_01__16 `"Budget priorities: Increase the number of classes"'
label variable P05_01__17 `"Budget priorities: Arrange transport"'
label variable P05_01__18 `"Budget priorities: Save the money"'

drop P05_01__18_old P05_01__999 P05_01_other

********************************************************************************

********************************************************************************

* Section 6 (P6 / T7 / D9)

// labelssss

#delimit ;
;
label define agree
1 `"Agree a lot"'
2 `"Agree"'
3 `"Do not agree nor disagree"'
4 `"Disagree"'
5 `"Disagree a lot"'
;
label define good
1 `"Very good"'
2 `"Good"'
3 `"Reasonable"'
4 `"Weak"'
5 `"Very weak"'
;
#delimit cr

foreach var in P06_01 P06_02 P06_03 P06_04 P06_05 P06_06 P06_07 P06_08 		///
				P06_09 P06_10 P06_11 P06_12 P06_13 P06_14{
	replace `var' = . if `var'==999
}

lab val P06_01 P06_02 P06_03 P06_04 P06_05 P06_06 P06_07 agree
lab val P06_08 P06_09 P06_10 P06_11 P06_12 P06_13 P06_14 good

label variable P06_01 `"Agree or disagree: Teacher motivation is high"'
label variable P06_02 `"Agree or disagree: Teachers take their responsibility very serious"'
label variable P06_03 `"Agree or disagree: Directors take their responsibilities very serious"'
label variable P06_04 `"Agree or disagree: Parent involvement is high"'
label variable P06_05 `"Agree or disagree: Parents always available to help with extra activities"'
label variable P06_06 `"Agree or disagree: School works well for future students"'
label variable P06_07 `"Agree or disagree: Teacher cares for student"'

label variable P06_08 `"Performance evaluation: director"'
label variable P06_09 `"Performance evaluation: school board"'
label variable P06_10 `"Performance evaluation: teacher"'
label variable P06_11 `"Performance evaluation: teacher last year"'
label variable P06_12 `"Performance evaluation: school team in general"'
label variable P06_13 `"Performance evaluation: parent committee"'
label variable P06_14 `"Performance evaluation: child respondent"'

********************************************************************************

********************************************************************************

* Section 7 (P7 / T8 / D10)

foreach var in  P07_01_01 P07_01_01_value P07_01_02 P07_01_02_value 		///
	P07_01_03 P07_01_01_hours P07_02 P07_03 P07_04 P07_05 P07_06 P07_07{
replace `var' = . if inlist(`var',999,-999999999)
}

lab val P07_01_01 P07_01_02 P07_01_03 P07_07 P07_09 dummy
lab val P07_02 P07_03 P07_04 P07_05 P07_06 freq2

label variable P07_01_01 `"Offered money to director or teacher"'
label variable P07_01_01_value `"Value money offered to teacher/director"'
label variable P07_01_02 `"Offered gift to director or teacher"'
label variable P07_01_02_value `"Value gifts offered to teacher/director"'
label variable P07_01_03 `"Offered service to director or teacher"'
label variable P07_01_01_hours `"Hours service offered to teacher/director"'

label variable P07_02 `"Frequency: Parent asks teacher to give private classes"'
label variable P07_03 `"Frequency: Teacher gives private classes"'
label variable P07_04 `"Frequency: Parents bribe teachers"'
label variable P07_05 `"Frequency: Misappropriation of school funds"'
label variable P07_06 `"Frequency: Directors and teachers get jobs because of personal relations"'

label variable P07_07 `"Made complaint or suggestion"'

label variable P07_08__1 `"Way of complain or suggestion: Talk to school director"'
label variable P07_08__2 `"Way of complain or suggestion: Talk to school board"'
label variable P07_08__3 `"Way of complain or suggestion: Talk to teacher of child"'
label variable P07_08__4 `"Way of complain or suggestion: Talk to other staff of the school"'
label variable P07_08__5 `"Way of complain or suggestion: Left a complaint in a complaint box of a public organization"'
label variable P07_08__6 `"Way of complain or suggestion: Via the comunal/municipal board"'
label variable P07_08__7 `"Way of complain or suggestion: At a forum for community representatives"'
label variable P07_08__8 `"Way of complain or suggestion: Via media (news papers, radio, tv"'
label variable P07_08__9 `"Way of complain or suggestion: Via a forum for NGOs"'
label variable P07_08__10 `"Way of complain or suggestion: Via a forum at the community/church"'

replace P07_08__6 = 1 if P07_08_other=="Notificação ao Administrador"
replace P07_08__6 = 1 if P07_08_other=="Soba"

drop P07_08__11 P07_08__999 P07_08_other

label variable P07_09 `"Are there (other) ways to complain or make suggestions?"'
label variable P07_10__1 `"(Other) way of complain or suggestion: Talk to school director"'
label variable P07_10__2 `"(Other) way of complain or suggestion: Talk to school board"'
label variable P07_10__3 `"(Other) way of complain or suggestion: Talk to teacher of child"'
label variable P07_10__4 `"(Other) way of complain or suggestion: Talk to other staff of the school"'
label variable P07_10__5 `"(Other) way of complain or suggestion: Left a complaint in a complaint box of a public organization"'
label variable P07_10__6 `"(Other) way of complain or suggestion: Via the comunal/municipal board"'
label variable P07_10__7 `"(Other) way of complain or suggestion: At a forum for community representatives"'
label variable P07_10__8 `"(Other) way of complain or suggestion: Via media (news papers, radio, tv"'
label variable P07_10__9 `"(Other) way of complain or suggestion: Via a forum for NGOs"'
label variable P07_10__10 `"(Other) way of complain or suggestion: Via a forum at the community/church"'

replace P07_10__3 = 1 if P07_10_other=="Nas reuniões com os professores"
replace P07_10__4 = 1 if P07_10_other=="dar a conhecer na comissão de pais... caso não atendesse iria para as entidades superiores"
replace P07_10__4 = 1 if P07_10_other=="Falar coma comissão de Pais e. encarregado de a educação"
replace P07_10__4 = 1 if P07_10_other=="Numa reunião"
replace P07_10__6 = 1 if P07_10_other=="Administrador"
replace P07_10__6 = 1 if P07_10_other=="Falar com o Soba"
replace P07_10__6 = 1 if P07_10_other=="Soba"
replace P07_10__6 = 1 if P07_10_other=="Soba"
replace P07_10__6 = 1 if P07_10_other=="Soba"
replace P07_10__6 = 1 if P07_10_other=="falar com o soba"
replace P07_10__6 = 1 if P07_10_other=="Procuradoria Municipal"
replace P07_10__7 = 1 if P07_10_other=="fazer uma denúncia"
replace P07_10__7 = 1 if P07_10_other=="PGR"
replace P07_10__7 = 1 if P07_10_other=="Tribunal"

lab val P07_08__1 P07_08__2 P07_08__3 P07_08__4 P07_08__5 P07_08__6 		///
		P07_08__7 P07_08__8 P07_08__9 P07_08__10 P07_10__1 P07_10__2 		///
		P07_10__3 P07_10__4 P07_10__5 P07_10__6 P07_10__7 P07_10__8 		///
		P07_10__9 P07_10__10 dummy

drop P07_10__11 P07_10__999 P07_10_other

********************************************************************************

********************************************************************************

* Section 8 (P8 / T9 / D11)

foreach var in  P08_01 P08_02 P08_03 P08_04 P08_05{
replace `var' = . if inlist(`var',999,-999999999)
}

// labelssss

#delimit ;
;
label define P08_04
0 `"Muito alto"'
1 `"Muito baixo"'
;
label define P08_05
0 `"No, you have to be carefull"'
1 `"Yes, others are trustworthy"'
;
#delimit cr

lab val P08_01 P08_02 P08_03 agree

label variable P08_01 `"Agree or disagree: Parents do not understand the benefits of education"'
label variable P08_02 `"Agree or disagree: Education gives an advantage to my children"'
label variable P08_03 `"Agree or disagree: Teachers get a fair salary"'
label values P08_04 P08_04
label variable P08_04 `"Disagree with fair salary statement because teacher salary is too low"'
label variable P08_05 `"Others are trustworthy"'
recode P08_05 (1=0) (0=1)
label values P08_05 P08_05

********************************************************************************

********************************************************************************

* Section 9 (P9 / T10 / D12)

label values P09_01 dummy
label variable P09_01 `"Member of club, social organisation or church"'

label variable P09_02 `"Number of social groups"'

replace P09_01 = 0 if ss_key=="70-20-77-96"
replace P09_02 = . if ss_key=="70-20-77-96"

save "$Endline_dtRaw/_intermediate files/parents.dta", replace

********************************************************************************

* add roster P09

use "$Endline_dtRaw/parents/Version 6/P09_roster.dta", clear

append using "$Endline_dtRaw/parents/Version 7/P09_roster.dta"

label drop _all

********************************************************************************

drop if inlist(interview__key,"64-28-57-75","92-80-89-09","35-78-86-48","78-47-99-28","32-88-27-22","19-30-08-74","73-75-71-61","56-26-81-71","09-83-44-78")
drop if inlist(interview__key,"65-16-41-36","43-49-48-80","40-10-54-24","44-53-39-68","78-78-89-65","60-25-22-66","53-15-69-36","90-33-37-37","87-73-93-23")
drop if inlist(interview__key,"80-84-89-39","28-07-29-80","15-73-45-11","24-91-83-04","02-63-39-39","44-60-63-41","24-35-80-93","24-53-68-55","80-09-35-07")
drop if inlist(interview__key,"81-88-65-04","09-92-96-89","59-45-79-54","22-33-89-91","45-39-75-00","33-30-68-34","89-66-12-98","03-37-77-37","35-47-45-19")
drop if inlist(interview__key,"67-10-11-98","44-55-09-95","84-57-80-09","15-52-63-87")

********************************************************************************

drop interview__id
rename interview__key 	ss_key
rename P09_roster__id roster_id_P09

drop if ss_key=="70-20-77-96"


/// labels

#delimit ;
;
label define dummy
0	"No"
1 	"Yes"
;
label define P09_04
1 `"Association for farmers/fishermen"'
2 `"Association for small business/traders"'
3 `"Association related to a profession (e.g. doctors, teachers)"'
4 `"Chamber of Commerce"'
5 `"Religious group"'
6 `"Political movement"'
7 `"Cultural association"'
8 `"Sport club"'
9 `"NGO"'
10 `"Credit club (kixikila)"'
11 `"Group based on ethnicity"'
;
#delimit cr

foreach var in  P09_04 P09_05 P09_06{
replace `var' = . if inlist(`var',999,-999999999)
}


label variable P09_03 `"Name of organisation"'
label values P09_04 P09_04
label variable P09_04 `"Type of organisation"'
label variable P09_05 `"Number of local members of organisation"'
label values P09_06 dummy
label variable P09_06 `"Respondent is a leader within the organisation"'

replace P09_04 = . if P09_04==12

replace P09_04 = 5 if P09_03=="Coral da igreja"
replace P09_04 = 3 if P09_03=="CDTE - Cedência de Técnicos Especializados, Lda"

drop P09_04_other


foreach var in P09_03 P09_04 P09_05 P09_06{
rename `var' `var'_
}
reshape wide P09_03_ P09_04_ P09_05_ P09_06_, i(ss_key) j(roster_id_P09)

forval x = 1/5{
lab var P09_03_`x' "(`x') Name of organisation"
lab var P09_04_`x' "(`x') Type of organisation"
lab var P09_05_`x' "(`x') Number of local members of organisation"
lab var P09_06_`x' "(`x') Respondent is a leader within the organisation"
}

save "$Endline_dtRaw/_intermediate files/parents_P09.dta", replace

********************************************************************************

use "$Endline_dtRaw/_intermediate files/parents.dta", clear

merge 1:1 ss_key using "$Endline_dtRaw/_intermediate files/parents_P09.dta"

drop _merge

order 	P09_03_1 P09_04_1 P09_05_1 P09_06_1 P09_03_2 P09_04_2 P09_05_2 		///
		P09_06_2 P09_03_3 P09_04_3 P09_05_3 P09_06_3 P09_03_4 P09_04_4 		///
		P09_05_4 P09_06_4 P09_03_5 P09_04_5 P09_05_5 P09_06_5, after(P09_02)

********************************************************************************

********************************************************************************

* Section 10 (P10 / T11 / D13)

foreach var in  P10_01 P10_02 P10_03 P10_04 P10_04_times P10_05 			///
				P10_05_times P10_06{
replace `var' = . if inlist(`var',999,-999999999)
}


#delimit ;
;
label define P10_03
0 `"Did not contribute"'
1 `"Contributed with time"'
2 `"Contributed with money"'
3 `"Contributed with time and money"'
;
#delimit cr

lab val P10_01 P10_02 agree
lab val P10_04 P10_05 P10_06 dummy

label variable P10_01 `"Agree or disagree: Other people are available to help in necessary"'
label variable P10_02 `"Agree or disagree: Here there are people that try to take advantage of others"'

label values P10_03 P10_03
label variable P10_03 `"Public good contribution with time or money"'

label variable P10_04 `"Participated in community work"'
label variable P10_04_times `"Number of times participated in community work"'
label variable P10_05 `"Gathering to demand improvements from leaders"'
label variable P10_05_times `"Number of times gathering to demand improvements from leaders"'
label variable P10_06 `"Voted in 2017"'

label variable P10_07__1 `"Sources of information about what the government does:Family friends neighbors"'
label variable P10_07__2 `"Sources of information about what the government does:Local newspaper"'
label variable P10_07__3 `"Sources of information about what the government does:Billboard advertisement"'
label variable P10_07__4 `"Sources of information about what the government does:National newspaper"'
label variable P10_07__5 `"Sources of information about what the government does:Radio"'
label variable P10_07__6 `"Sources of information about what the government does:TV"'
label variable P10_07__7 `"Sources of information about what the government does:Group or association"'
label variable P10_07__8 `"Sources of information about what the government does:Business partners and colleague"'
label variable P10_07__9 `"Sources of information about what the government does:Community leaders"'
label variable P10_07__10 `"Sources of information about what the government does:Government representative"'
label variable P10_07__11 `"Sources of information about what the government does:NGO"'
label variable P10_07__12 `"Sources of information about what the government does:Internet (social media)"'

replace P10_07__1 = 1 if P10_07_other=="Vejo apenas nos meus andamentos"
replace P10_07__5 = 1 if P10_07_other=="as vezes pela rádio da vizinhança em função da falta de pilha"
replace P10_07__7 = 1 if P10_07_other=="Igreja"
replace P10_07__9 = 1 if P10_07_other=="A partir ou por intermedio do soba."
replace P10_07__9 = 1 if P10_07_other=="Apenas por intermedio do sobado."
replace P10_07__9 = 1 if P10_07_other=="No soba"

drop P10_07__13 P10_07__999 P10_07_other

lab val P10_07__1 P10_07__2 P10_07__3 P10_07__4 P10_07__5 P10_07__6 		///
		P10_07__7 P10_07__8 P10_07__9 P10_07__10 P10_07__11 P10_07__12 dummy

********************************************************************************

********************************************************************************

* Section 11 (P11 / T12 / D14)

foreach var in  P11_02_01 P11_03_01 P11_02_02 P11_03_02 P11_02_03 			///
P11_03_03 P11_02_04 P11_03_04 P11_02_05 P11_03_05 P11_02_06 P11_03_06 		///
P11_02_07 P11_03_07 P11_02_08 P11_03_08 P11_02_09 P11_03_09 P11_02_10 		///
P11_03_10 P11_02_11 P11_03_11 P11_02_12 P11_03_12 P11_02_13 P11_03_13 		///
P11_02_14 P11_03_14 P11_02_15 P11_03_15 P11_02_16_measure P11_02_16_01 		///
P11_02_16_02 P11_03_16 P11_02_17 P11_03_17 P11_02_18 P11_03_18 P11_02_19 	///
P11_03_19 P11_02_20 P11_03_20{
replace `var' = . if inlist(`var',999,-999999999)
}

#delimit ;
;
label define P11_02_16_measure
1 `"Hectares"'
2 `"Squared meters"'
;
#delimit cr

lab val P11_01__1 P11_01__2 P11_01__3 P11_01__4 P11_01__5 P11_01__6 		///
		P11_01__7 P11_01__8 P11_01__9 P11_01__10 P11_01__11 P11_01__12 		///
		P11_01__13 P11_01__14 P11_01__15 P11_01__16 P11_01__17 P11_01__18 	///
		P11_01__19 P11_01__20 dummy

label variable P11_01__1 `"Possession in household: Books"'
label variable P11_01__2 `"Possession in household: Radios"'
label variable P11_01__3 `"Possession in household: Televisions"'
label variable P11_01__4 `"Possession in household: Computers"'
label variable P11_01__5 `"Possession in household: Yablets"'
label variable P11_01__6 `"Possession in household: Digital cameras"'
label variable P11_01__7 `"Possession in household: Smartphones"'
label variable P11_01__8 `"Possession in household: Normal phones"'
label variable P11_01__9 `"Possession in household: Bicycles"'
label variable P11_01__10 `"Possession in household: Motor bikes"'
label variable P11_01__11 `"Possession in household: Cars"'
label variable P11_01__12 `"Possession in household: Ovens/microwaves"'
label variable P11_01__13 `"Possession in household: Washing machines"'
label variable P11_01__14 `"Possession in household: Fridges"'
label variable P11_01__15 `"Possession in household: Stoves"'
label variable P11_01__16 `"Possession in household: Land"'
label variable P11_01__17 `"Possession in household: Houses"'
label variable P11_01__18 `"Possession in household: Animals"'
label variable P11_01__19 `"Possession in household: Big agricultural equipment"'
label variable P11_01__20 `"Possession in household: Small agricultural equipment"'

label variable P11_02_01 `"Number of books"'
label variable P11_03_01 `"Value of books"'
label variable P11_02_02 `"Number of radios"'
label variable P11_03_02 `"Value of radios"'
label variable P11_02_03 `"Number of televisions"'
label variable P11_03_03 `"Value of televisions"'
label variable P11_02_04 `"Number of computers"'
label variable P11_03_04 `"Value of computers"'
label variable P11_02_05 `"Number of tablets"'
label variable P11_03_05 `"Value of tablets"'
label variable P11_02_06 `"Number of digital cameras"'
label variable P11_03_06 `"Value of digital cameras"'
label variable P11_02_07 `"Number of smartphones"'
label variable P11_03_07 `"Value of smartphones"'
label variable P11_02_08 `"Number of normal phones"'
label variable P11_03_08 `"Value of normal phones"'
label variable P11_02_09 `"Number of bicycles"'
label variable P11_03_09 `"Value of bicycles"'
label variable P11_02_10 `"Number of motor bikes"'
label variable P11_03_10 `"Value of motor bikes"'
label variable P11_02_11 `"Number of cars"'
label variable P11_03_11 `"Value of cars"'
label variable P11_02_12 `"Number of ovens/microwaves"'
label variable P11_03_12 `"Value of ovens/microwaves"'
label variable P11_02_13 `"Number of washing machines"'
label variable P11_03_13 `"Value of washing machines"'
label variable P11_02_14 `"Number of fridges"'
label variable P11_03_14 `"Value of fridges"'
label variable P11_02_15 `"Number of stoves"'
label variable P11_03_15 `"Value of stoves"'

label values P11_02_16_measure P11_02_16_measure
label variable P11_02_16_measure `"Type of measure: hectares or squared meters"'

label variable P11_02_16_01 `"Size of land"'
label variable P11_02_16_02 `"Size of land"'
label variable P11_03_16 `"Value of land"'
label variable P11_02_17 `"Number of houses"'
label variable P11_03_17 `"Value of houses"'
label variable P11_02_18 `"Number of animals"'
label variable P11_03_18 `"Value of animals"'
label variable P11_02_19 `"Number of big agricultural equipment"'
label variable P11_03_19 `"Value of big agricultural equipment"'
label variable P11_02_20 `"Number of small agricultural equipment"'
label variable P11_03_20 `"Value of small agricultural equipment"'

drop P11_01__999

********************************************************************************

save "$Endline_dtRaw/_intermediate files/parents.dta", replace

********************************************************************************
